Whenever I add a new machine and run the playbook for the first time it hangs. When I ssh to that machine from Ansible server and exit and run the playbook again then it works.
Most likely Ansible gets stuck on verifying a host key and when you connect with ssh
, you are prompted and confirm it manually.
Add host_key_checking=false
to your Ansible configuration file.