I am trying to automate these steps so that I don't need to do this on every machines manually. I need to install latest app server software (abc.tar.gz) on all the unix boxes.
I need to do this in around 12 machines - "machine1" ... "machine12"
. I have a master machine "machine0"
which has abc.tar.gz
file so I was thinking to run my script from this machine only and install abc.tar.gz
software by following below steps in all those 12 machines one by one. My unix account id is david
and my process runs as golden
user.
This is the steps I follow if I am installing abc.tar.gz
in "machine1":
david@machine1:~$ sudo scp david@machine0:/home/david/abc.tar.gz .
david@machine1:~$ sudo stop test_server
david@machine1:~$ sudo su - golden
golden@machine1:~$ cd /opt/process
golden@machine1:/opt/process$ rm -rf *
golden@machine1:/opt/process$ exit
david@machine1:~$ sudo cp abc.tar.gz /opt/process
david@machine1:~$ sudo chown -R golden /opt/process
david@machine1:~$ sudo su - golden
golden@machine1:~$ cd /opt/process
golden@machine1:/opt/process$ tar -xvzf abc.tar.gz
golden@machine1:/opt/process$ exit
david@machine1:~$ sudo start test_server
How can I automate this so that it can do the same steps in all 12 machines one bye one? I mean install abc.tar.gz
in machine1
first, then install on machine2
and go on.. I want to run this script from machine0
only.
Is there any way to automate this?
I would recommend a provisioning tool such as Fabric or Ansible for this. Both are fairly easy to set up, and will allow you to do more the just the command you need in this case, since you be able to build off you initial playbooks or fabfile depending on which tool you go with.
Docs for Fabric can be found here: http://docs.fabfile.org/en/1.10/ Docs for Ansible can be found here: http://docs.ansible.com/ansible/intro_getting_started.html
You'll need some comfort with SSH keys and SSH configurations for both tools, which you can find in the docs as well.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments