Ansible takes a long time to complete task setup


From time to time there is a problem with ansible-playbook : it "hangs" on the setup task for a very long time. The detailed mode did not say anything intelligible:

TASK [setup] *******************************************************************
ESTABLISH LOCAL CONNECTION FOR USER: dmitry EXEC /bin/sh -c '( umask 22 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1464268193.51-68811809432139 `" && echo "` echo $HOME/.ansible/tmp/ansible-tmp-1464268193.51-68811809432139 `" )' PUT /tmp/tmpD6mRtI TO /home/dmitry/.ansible/tmp/ansible-tmp-1464268193.51-68811809432139/setup EXEC /bin/sh -c 'LANG=ru_RU.UTF-8 LC_ALL=ru_RU.UTF-8 LC_MESSAGES=ru_RU.UTF-8 /usr/bin/python /home/dmitry/.ansible/tmp/ansible-tmp-1464268193.51-68811809432139/setup; rm -rf "/home/dmitry/.ansible/tmp/ansible-tmp-1464268193.51-68811809432139/" > /dev/null 2>&1'

I didn’t know exactly how long it takes, but somewhere around 10-15 minutes, then the execution takes place at a normal pace.

Has anyone had any experience with how to treat it?


I think this is very similar to the very common problem "midnight commander takes a long time to start up" (name resolution problem – hosts does not have an ip for hostname) – and you have something wrong with host name resolution. The upside to this version is that the hostname resolved to from your output.

I won’t tell you any more specifics: if the direction of solving the problem is guessed correctly, then you need to know how your network is arranged at the enterprise – what DNS servers, DHCP servers, what environment, etc.

Scroll to Top