Is it normal for this local ping to take two minutes?
`
$ cat hosts
localhost ansible_connection=local
$ cat test.yml
Is it normal for this local ping to take two minutes?
`
$ cat hosts
localhost ansible_connection=local
$ cat test.yml
Is it normal for this local ping to take two minutes?
Well you are doing a lot more than
ansible localhost -m ping
The tool is doing all the gathering facts which can take some time and the
recap rules.
OK. I created this scenario to isolate the issue. But consider my actual scenario: I want to use the digitalocean module to create a droplet or to ensure it already exists. Something that would normally take about a second (if it already exists) with an ansible playbook would take two minutes. Is that the best I can do with Ansible? Am I doing something wrong?
I think you are jumping to conclusions from way too little data
Here is what happens doing exactly what you did on a CentOS-7 box running
on a Intel Core Duo from 2009.
[root@shizuku ~]# time ansible-playbook -i hosts test.yml
PLAY [localhost]
Also run with -vvv option and see if there is a line where it pauses for a
while.
Just add gather_facts: false to your play.
Duh. I forgot that advice. Using my earlier example on my slowboat box
[root@xanadu ansible]# time ansible-playbook -i hosts test.yml -vvv
PLAY [localhost]
With “gather_facts: false” it is instantaneous. I had already tried the verbose output, and it shows the following line where it gets stuck:
u’LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /Users/luismarques/.ansible/tmp/ansible-tmp-1424825965.19-173089065311241/setup; rm -rf /Users/luismarques/.ansible/tmp/ansible-tmp-1424825965.19-173089065311241/ >/dev/null 2>&1’]
I had tried to interrupt ansible (ctrl-C) and run that python command manually, and it had output some JSON after the two minutes (the facts?). It didn’t show any intermediate debug output.
I’m running ansible 1.8.3.
Is the gather_facts flag the proper solution, or is it just a workaround?
Smooge: regarding your slow machines with fast execution, were you using “gather_facts: false”?
With "gather_facts: false" it is instantaneous. I had already tried the
verbose output, and it shows the following line where it gets stuck:<localhost> u'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python
/Users/luismarques/.ansible/tmp/ansible-tmp-1424825965.19-173089065311241/setup;
rm -rf
/Users/luismarques/.ansible/tmp/ansible-tmp-1424825965.19-173089065311241//dev/null 2>&1']
I had tried to interrupt ansible (ctrl-C) and run that python command
manually, and it had output some JSON after the two minutes (the facts?). It
didn't show any intermediate debug output.
Ah, I'd guess it doesn't return anything until all facts are gathered
(i.e. they don't 'stream').
If I had to bet* I'd blame name resolution of some kind, but if you
want to try science..
You have the generated python and it reproduces the error,
so start by commenting everything out and uncomment+test until you've
got the delay.
I'm running ansible 1.8.3.
Is the gather_facts flag the proper solution, or is it just a workaround?
If you don't actually use any of the facts, there's no downside.
* ok you twisted my arm, $10 says DNS issues
DNS resolution timeout normally defaults to 2 minutes on most every OS that I’ve seen, so that is my thought as well.