Could any provide me a better command than below
rsync -e "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l $USER `cat commandResult` "ansible-playbook --connection=local /home/ec2-user/ansible/plays/install.yml"
Could any provide me a better command than below
rsync -e "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l $USER `cat commandResult` "ansible-playbook --connection=local /home/ec2-user/ansible/plays/install.yml"
It would be much easier to execute the playbook like ansible was intended to work, to get started you can create a file with the host you want to execute the playbook on, for example called 'hosts':
[webserver]
web1.hostname.example
Then in your playbook you can target this host/host group like so:
---
- hosts: webserver
<<playbook contents here>>
Your ansible-playbook command will then look like this:
ansible-playbook -i hosts /home/ec2-user/ansible/plays/install.yml
If you want to ignore host key checking like you are in your ssh
command, you can do this a number of ways as found in this stackoverflow question