![]() Or even better: ssh sudo uptimeĪs the ssh works fine you can create an inventory file for ansible: inventory.yml (yes, it's in YAML format, so whitespace matters): all:Īnd now run ansible to use uptime command on all of your hosts in the inventory: ansible -i inventory.yml -one-line all -a uptime So this command should work without asking any password on any of your managed hosts (running uptime command on the remote server): ssh uptime Your user has an ssh key already installed on the remote hosts (and for most command you want passordless sudo rights there as well). Ansible uses ssh and anyway it is a nice tool to manage multiple hosts, but now I am just focusing on the topic to run a single command on multiple hosts. I would suggest to use Ansible ad hoc commands for this job.
0 Comments
Leave a Reply. |