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

~]$ ansible-playbook example.yml -vvv
TASK [Gathering Facts] 
task path: /home/john.doe/example.yml:4
<>> 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 '/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 In this example, there is a mismatch between the server hostname and the servers IP address in John Doe's known_hosts file.

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

~]$ ssh
Warning: the ECDSA host key for '' differs from the key for the IP address ''
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


Add a Comment

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