Bootstrap FreeKB - Ansible - Resolve "playbook hangs at Gathering Facts"
Ansible - Resolve "playbook hangs at Gathering Facts"

Updated:   |  Ansible articles

Let's say you have a playbook that hangs at a certain tasks, often at Gathering Facts.

~]$ ansible-playbook example.yml
PLAY [all] 
TASK [Gathering Facts]

 

In this scenario, using the -vvv (very very verbose) flag may help determine the issue. In this example, the playbook is hanging when attempting to make an SSH connection from the Ansible control node to server1.example.com.

~]$ ansible-playbook example.yml -vvv
TASK [Gathering Facts] 
task path: /home/john.doe/example.yml:4
<server1.example.com> ESTABLISH SSH CONNECTION FOR USER: john.doe
<server1.example.com>> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="john.doe"' -o ConnectTimeout=10 -o ControlPath=/home/john.doe/.ansible/cp/fec7d2c5e9 server1.example.com '/bin/sh -c '"'"'echo ~john.doe && sleep 0'"'"''

 

In this scenario, I would use the SSH command to see if there are any issues making an SSH connection from the Ansible control node to server1.example.com. In this example, there is a mismatch between the server hostname server1.example.com and the servers IP address in John Doe's known_hosts file.

Check out my article FreeKB - Ansible Getting Started with SSH.

~]$ ssh john.doe@server1.example.com
Warning: the ECDSA host key for 'server1.example.com' differs from the key for the IP address '10.84.176.94'
Offending key for IP in /home/john.doe/.ssh/known_hosts2:570
Matching host key in /home/john.doe/.ssh/known_hosts:19
Are you sure you want to continue connecting (yes/no)?

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter a1b0db in the box below so that we can be sure you are a human.