Adhoc-Commands
Parallelism & Shell Commands
To set up SSH agent
$ ssh-agent bash
$ ssh-add ~/.ssh/id_rsa
To use SSH with a password instead of keys, you can use --ask-pass (-K)
$ ansible europe -a "/sbin/reboot" -f 20
To run /usr/bin/ansible from a user account, not the root
$ ansible europe -a "/usr/bin/foo" -u username
To run commands through privilege escalation and not through user account
$ ansible europe -a "/usr/bin/foo" -u username --become [--ask-become-pass]
If you are using password less method then use --ask-become-pass (-K) to interactively get the password to be use You can become a user, other than root by using --become-user
$ ansible europe -a "/usr/bin/foo" -u username --become --become-user otheruser [--ask-become-pass]
Last updated