How to execute multiple commands remotely on few servers?

user1950349

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?

cgutshal

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Running shell commands remotely on multiple servers?

From Dev

Execute commands on linux remotely through Dropbox ?

From Dev

Remotely execute commands but still have control of the host

From Dev

How to execute multiple CLI commands in a python script?

From Dev

How to execute multiple commands in Bash, some in the background

From Dev

How to execute multiple CLI commands in a python script?

From Dev

How to use pssh to run multiple servers with different commands?

From Dev

Execute commands on a remote servers by 2 scripts

From Dev

Bash for loop to execute commands on remote servers

From Dev

Is it possible to execute commands remotely (ssh), through a Java program

From Dev

Running sequential commands through ssh on multiple servers

From Java

Using Docker-Compose, how to execute multiple commands

From Dev

How to execute multiple commands after opening a new terminal tab

From Dev

How to add multiple commands in series in "Execute Windows Batch Command" in Jenkins

From Dev

How can i execute multiple commands with JAVA code?

From Dev

How do I execute multiple commands when using find?

From Dev

How to execute multiple commands after opening a new terminal tab

From Dev

How do I execute multiple commands using the same argument?

From Dev

how to Execute multiple shell commands in tsystem component talend

From Dev

How do i execute multiple commands sequentially on the command line?

From Dev

How to execute multiple commands in system() , also using a variable

From Dev

How to add multiple commands in series in "Execute Windows Batch Command" in Jenkins

From Dev

How can I execute multiple find commands in a single line?

From Dev

How to execute multiple commands on remote server and get the output?

From Dev

How to autorun commands on OSX when ssh remotely?

From Dev

Execute multiple commands after [ test

From Dev

Delphi - CreateProcess - Execute multiple commands

From Dev

Execute multiple commands after [ test

From Dev

Running a .sh to execute multiple commands

Related Related

  1. 1

    Running shell commands remotely on multiple servers?

  2. 2

    Execute commands on linux remotely through Dropbox ?

  3. 3

    Remotely execute commands but still have control of the host

  4. 4

    How to execute multiple CLI commands in a python script?

  5. 5

    How to execute multiple commands in Bash, some in the background

  6. 6

    How to execute multiple CLI commands in a python script?

  7. 7

    How to use pssh to run multiple servers with different commands?

  8. 8

    Execute commands on a remote servers by 2 scripts

  9. 9

    Bash for loop to execute commands on remote servers

  10. 10

    Is it possible to execute commands remotely (ssh), through a Java program

  11. 11

    Running sequential commands through ssh on multiple servers

  12. 12

    Using Docker-Compose, how to execute multiple commands

  13. 13

    How to execute multiple commands after opening a new terminal tab

  14. 14

    How to add multiple commands in series in "Execute Windows Batch Command" in Jenkins

  15. 15

    How can i execute multiple commands with JAVA code?

  16. 16

    How do I execute multiple commands when using find?

  17. 17

    How to execute multiple commands after opening a new terminal tab

  18. 18

    How do I execute multiple commands using the same argument?

  19. 19

    how to Execute multiple shell commands in tsystem component talend

  20. 20

    How do i execute multiple commands sequentially on the command line?

  21. 21

    How to execute multiple commands in system() , also using a variable

  22. 22

    How to add multiple commands in series in "Execute Windows Batch Command" in Jenkins

  23. 23

    How can I execute multiple find commands in a single line?

  24. 24

    How to execute multiple commands on remote server and get the output?

  25. 25

    How to autorun commands on OSX when ssh remotely?

  26. 26

    Execute multiple commands after [ test

  27. 27

    Delphi - CreateProcess - Execute multiple commands

  28. 28

    Execute multiple commands after [ test

  29. 29

    Running a .sh to execute multiple commands

HotTag

Archive