Local ping takes 2 minutes

80 views
Skip to first unread message

Luís Marques

unread,
Feb 24, 2015, 4:40:25 PM2/24/15
to ansible...@googlegroups.com
Is it normal for this local ping to take two minutes?

$ cat hosts 
localhost ansible_connection=local

$ cat test.yml 
---
- hosts: localhost
  tasks:
  - name: test
    ping:

$ time ansible-playbook -i hosts test.yml 

PLAY [localhost] ************************************************************** 

GATHERING FACTS *************************************************************** 
ok: [localhost]

TASK: [test] ****************************************************************** 
ok: [localhost]

PLAY RECAP ******************************************************************** 
localhost                  : ok=2    changed=0    unreachable=0    failed=0   


real 2m1.637s
user 0m0.266s
sys 0m0.245s

$ uname -a
Darwin Hostname.local 14.1.0 Darwin Kernel Version 14.1.0: Mon Dec 22 23:10:38 PST 2014; root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64



Stephen John Smoogen

unread,
Feb 24, 2015, 7:01:30 PM2/24/15
to ansible...@googlegroups.com
On 24 February 2015 at 14:40, Luís Marques <luism...@gmail.com> wrote:
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.
 

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4bc422a9-e27b-464b-b640-68c528b0ac7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Stephen J Smoogen.

Luís Marques

unread,
Feb 24, 2015, 7:09:45 PM2/24/15
to ansible...@googlegroups.com
On Wednesday, February 25, 2015 at 12:01:30 AM UTC, Smooge wrote:
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?

Stephen John Smoogen

unread,
Feb 24, 2015, 7:19:03 PM2/24/15
to ansible...@googlegroups.com
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] ************************************************************** 

GATHERING FACTS *************************************************************** 
ok: [localhost]

TASK: [test] ****************************************************************** 
ok: [localhost]

PLAY RECAP ******************************************************************** 
localhost                  : ok=2    changed=0    unreachable=0    failed=0   


real    0m1.347s
user    0m0.705s
sys     0m0.465s

tested this with 2 other systems that are even slower and they are all at 1.2 -> 1.5 seconds.

So something is wrong on your setup.. what version of ansible are you using? 
 

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Stephen J Smoogen.

Stephen John Smoogen

unread,
Feb 24, 2015, 7:20:16 PM2/24/15
to ansible...@googlegroups.com
On 24 February 2015 at 17:19, Stephen John Smoogen <smo...@gmail.com> wrote:


On 24 February 2015 at 17:09, Luís Marques <luism...@gmail.com> wrote:
On Wednesday, February 25, 2015 at 12:01:30 AM UTC, Smooge wrote:
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] ************************************************************** 

GATHERING FACTS *************************************************************** 
ok: [localhost]

TASK: [test] ****************************************************************** 
ok: [localhost]

PLAY RECAP ******************************************************************** 
localhost                  : ok=2    changed=0    unreachable=0    failed=0   


real    0m1.347s
user    0m0.705s
sys     0m0.465s

tested this with 2 other systems that are even slower and they are all at 1.2 -> 1.5 seconds.

So something is wrong on your setup.. what version of ansible are you using? 


Also run with -vvv option and see if there is a line where it pauses for a while. 


--
Stephen J Smoogen.

Brian Coca

unread,
Feb 24, 2015, 7:29:03 PM2/24/15
to ansible...@googlegroups.com

Just add gather_facts: false to your play.

Stephen John Smoogen

unread,
Feb 24, 2015, 8:00:55 PM2/24/15
to ansible...@googlegroups.com
On 24 February 2015 at 17:28, Brian Coca <bc...@ansible.com> wrote:

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] ************************************************************** 

TASK: [test] ****************************************************************** 
<localhost> REMOTE_MODULE ping
<localhost> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1424825978.48-193148108817334 && echo $HOME/.ansible/tmp/ansible-tmp-1424825978.48-193148108817334']
<localhost> PUT /tmp/tmpwkHcKI TO /root/.ansible/tmp/ansible-tmp-1424825978.48-193148108817334/ping
<localhost> EXEC ['/bin/sh', '-c', u'LANG=C LC_CTYPE=C /usr/bin/python /root/.ansible/tmp/ansible-tmp-1424825978.48-193148108817334/ping; rm -rf /root/.ansible/tmp/ansible-tmp-1424825978.48-193148108817334/ >/dev/null 2>&1']
ok: [localhost] => {"changed": false, "ping": "pong"}

PLAY RECAP ******************************************************************** 
localhost                  : ok=1    changed=0    unreachable=0    failed=0   


real    0m0.173s
user    0m0.135s
sys     0m0.040s

so hopefully for original poster it will drop similarly.

 

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Stephen J Smoogen.

Luís Marques

unread,
Feb 24, 2015, 8:05:45 PM2/24/15
to ansible...@googlegroups.com
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.

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"?

Dick Davies

unread,
Feb 25, 2015, 4:55:21 AM2/25/15
to ansible list
On 25 February 2015 at 01:05, Luís Marques <luism...@gmail.com> wrote:
> 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

Mark McCoy

unread,
Feb 25, 2015, 10:53:42 AM2/25/15
to ansible-project
DNS resolution timeout normally defaults to 2 minutes on most every OS that I've seen, so that is my thought as well.
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages