Oz Tiram e9571966ab Update how to read a password | 5 anos atrás | |
---|---|---|
README.md | 5 anos atrás | |
banshible.sh | 5 anos atrás | |
test.sh | 5 anos atrás |
You don't need ansible to a set of task on a remote machine. Using BASH and SSH is more than enough. But most people tend to skip learning the fine details of using SSH, sudo and BASH.
Here is an exterme minimal framework to run a script on a remote server.
banshible.sh <remote server> <script-name>
If you need to execute a command with escalated priveleges you can use sudo on the remote machine. If you need a password to become root you can echo it. Here is an example script that you can run on a remote machine:
$ cat test.sh
whoami
echo $PW | sudo -S 2>/dev/null whoami
To run this script on a remote machine:
export PW=<yourVerySecretPassword>
$ ./banshible.sh <server> test.sh
oz123
root
You can run this script also with specifying the user on the remote machine:
read -s PW
export PW=<VerySecretPasswordOfRemoteUser>
$ ./banshible.sh <RemoteUser@server> test.sh
RemoteUser
root