I've been able to reproduce but not entirely consistently.  If I have
only one line in my /etc/hosts file:

127.0.0.1   localhost

Running: time ansible all -i "localhost," -m setup -c local

takes anywhere from 0.9 seconds to 15 seconds.

Adding a second line to /etc/hosts:
127.0.0.1 roan.lan

brings runtime into the 0.3 to 0.7 second range.  So I think there's
definitely something else going on in the system besides ansible
that's making this noticable.... Perhaps some non-parallelizable
segment of Fedora's DNS lookup mechanism...

I do note that having the second line always makes things faster (when
the system is in the 0.9 second range for the non-fqdn case, it's in
the 0.3 second range for the fqdn case; when it's in the 15 second
range for non-fqdn, it's in the 0.7 second range for fqdn.

I don't know if this is something that can be addressed within
ansible, if it's a problem that the OS needs to look into, or is just
considered a host configuration bug.

-Toshio

On Tue, Nov 4, 2014 at 6:36 AM, Michael DeHaan <[email protected]> wrote:
> If someone can help isolate the slow methods on those systems, that would be
> great.
>
> We are not currently seeing this.
>
>
>
> On Mon, Nov 3, 2014 at 2:29 PM, Scott Sturdivant
> <[email protected]> wrote:
>>
>> Honestly I haven't bothered digging into ansible source, but here's my
>> results on Fedora 20, same as the OP:
>>
>> $ ansible --version
>> ansible 1.7.2
>>
>> # Without valid FQDN entry
>> $ time ansible all -i "localhost," -m setup -c local
>> 0.32s user 0.11s system 2% cpu 20.528 total
>>
>> # With valid FQDN entry
>> $ time ansible all -i "localhost," -m setup -c local
>> 0.26s user 0.08s system 83% cpu 0.399 total
>>
>>
>> I'd call a twenty second speed up considerable.
>>
>>
>> I get the same behavior with devel:
>> $ ansible --version
>> ansible 1.8 (devel e1662422bf) last updated 2014/11/03 12:22:34 (GMT -600)
>>   lib/ansible/modules/core: (detached HEAD 7f611468a8) last updated
>> 2014/10/24 11:15:28 (GMT -600)
>>   lib/ansible/modules/extras: (detached HEAD a0df36c6ab) last updated
>> 2014/10/24 11:15:31 (GMT -600)
>>   v2/ansible/modules/core: (detached HEAD cb69744bce) last updated
>> 2014/10/24 11:15:35 (GMT -600)
>>   v2/ansible/modules/extras: (detached HEAD 8a4f07eecd) last updated
>> 2014/10/24 11:15:38 (GMT -600)
>>   configured module search path = None
>>
>> # Without valid FQDN entry
>> $ time ansible all -i "localhost," -m setup -c local
>> 0.37s user 0.14s system 2% cpu 20.614 total
>>
>> # Without valid FQDN entry
>> $ time python -c 'import socket; socket.gethostname()'
>> python -c 'import socket; socket.gethostname()'  0.01s user 0.01s system
>> 97% cpu 0.021 total
>>
>> This last one implies that the socket.gethostname() is not to blame.
>>
>>
>> On Mon, Nov 3, 2014 at 12:10 PM, Michael DeHaan <[email protected]>
>> wrote:
>>>
>>> "Do you have a valid FQDN entry in /etc/hosts?  Without that, the setup
>>> module slows down considerably."
>>>
>>> Assume you're referring to the one socket.gethostname() equivalent as a
>>> DNS hit?
>>>
>>> I'm not sure it would be *considerably*... though interested in any
>>> timing info you might have.
>>>
>>> (May imply DNS issues?)
>>>
>>>
>>>
>>>
>>> On Mon, Nov 3, 2014 at 10:04 AM, Scott Sturdivant
>>> <[email protected]> wrote:
>>>>
>>>> Do you have a valid FQDN entry in /etc/hosts?  Without that, the setup
>>>> module slows down considerably.
>>>>
>>>> On Mon, Nov 3, 2014 at 7:24 AM, Michael DeHaan <[email protected]>
>>>> wrote:
>>>>>
>>>>> Hmm, that's quite curious and not something I've heard reported much.
>>>>>
>>>>> There's also not much logic to get stuck in a loop in there.
>>>>>
>>>>> If you have Python skills, using "./hacking/test-module" from a
>>>>> checkout on that machine would allow inserting some debug that could help
>>>>> isolate why it may be taking longer, if it's in fact the setup module that
>>>>> is spending the time.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Sun, Nov 2, 2014 at 7:24 AM, pixel fairy <[email protected]>
>>>>> wrote:
>>>>>>
>>>>>> the setup module (and any playbooks) takes an extra 2 min for a fedora
>>>>>> 20 based vm. other ansible modules, at least command(date) and yum 
>>>>>> (upgrade
>>>>>> all), take less than a second, on an up to date machine.
>>>>>>
>>>>>> tried from os x 10.10 (homebrew) and ubuntu 14.04, both running
>>>>>> ansible 1.7.2. heres, the -vvvv
>>>>>>
>>>>>> <akaran> ESTABLISH CONNECTION FOR USER: pixel
>>>>>> <akaran> REMOTE_MODULE setup
>>>>>> <akaran> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto',
>>>>>> '-o', 'ControlPersist=60s', '-o',
>>>>>> 'ControlPath=/Users/pixel/.ansible/cp/ansible-ssh-%h-%p-%r', '-o',
>>>>>> 'KbdInteractiveAuthentication=no', '-o',
>>>>>> 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey',
>>>>>> '-o', 'PasswordAuthentication=no', '-o', 'ConnectTimeout=10', 'akaran',
>>>>>> "/bin/sh -c 'mkdir -p
>>>>>> $HOME/.ansible/tmp/ansible-tmp-1414929572.02-34091227529968 && chmod a+rx
>>>>>> $HOME/.ansible/tmp/ansible-tmp-1414929572.02-34091227529968 && echo
>>>>>> $HOME/.ansible/tmp/ansible-tmp-1414929572.02-34091227529968'"]
>>>>>> <akaran> PUT
>>>>>> /var/folders/2v/w9x69ytx017ckmpz4hmjn5qh0000gn/T/tmpPQYuj0 TO
>>>>>> /home/pixel/.ansible/tmp/ansible-tmp-1414929572.02-34091227529968/setup
>>>>>> <akaran> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto',
>>>>>> '-o', 'ControlPersist=60s', '-o',
>>>>>> 'ControlPath=/Users/pixel/.ansible/cp/ansible-ssh-%h-%p-%r', '-o',
>>>>>> 'KbdInteractiveAuthentication=no', '-o',
>>>>>> 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey',
>>>>>> '-o', 'PasswordAuthentication=no', '-o', 'ConnectTimeout=10', 'akaran',
>>>>>> u"/bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python
>>>>>> /home/pixel/.ansible/tmp/ansible-tmp-1414929572.02-34091227529968/setup; 
>>>>>> rm
>>>>>> -rf /home/pixel/.ansible/tmp/ansible-tmp-1414929572.02-34091227529968/
>>>>>> >/dev/null 2>&1'"]
>>>>>> ... facts ...
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> 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 [email protected].
>>>>>> To post to this group, send email to [email protected].
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/ansible-project/7bf63dde-3d2a-4562-90b1-5a950800326d%40googlegroups.com.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>>
>>>>> --
>>>>> 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 [email protected].
>>>>> To post to this group, send email to [email protected].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgxXbk4GNt8Bj-uwLak7A%2ByEGWN1JD-SePXZSD8M-rynSw%40mail.gmail.com.
>>>>>
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>>
>>>> --
>>>> 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 [email protected].
>>>> To post to this group, send email to [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/ansible-project/CAPcsqx%3DEMiY5Rgnxwa-S_AWHB5uY%2BtaWy54p1iYsb8Kny7PTpg%40mail.gmail.com.
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>> --
>>> 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 [email protected].
>>> To post to this group, send email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgx26bAEA0-uWDP-XrpUZjTHLkJGuAnCZMq7uFxViVB_ag%40mail.gmail.com.
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAPcsqxmZ5DeneYMKQw6V3S7Qch3n1qMbw5K0C_Fy95yWqWo_TA%40mail.gmail.com.
>>
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgwKF5hdBYHE1Lq2Nfq_u-Pkzyoqq_%3DVgzudpUMyX9Rdew%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAG9juEp1MZtRTbsYo-t5pEgf88enX-h5BRp07Ju6rbs81wgb7A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to