Ansible 1.7.1 : Slowness at playbook startup

53 views
Skip to first unread message

Ludovic Petetin

unread,
Sep 18, 2014, 8:25:59 AM9/18/14
to ansible...@googlegroups.com
Here is a simple playbook test.yml:
---

- hosts: 127.0.0.1
  tasks:
    - fail:


The execution time in Ansible 1.6.6 is :
[ludovic@dc1-se-ifr-ansible-dev ansible]$ time ansible-playbook -v test.yml

PLAY [127.0.0.1] **************************************************************

GATHERING FACTS ***************************************************************
ok: [127.0.0.1]

TASK: [fail ] *****************************************************************
failed: [127.0.0.1] => {"failed": true}
msg: Failed as requested from task

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
           to retry, use: --limit @/home/ludovic/test.retry

127.0.0.1                  : ok=1    changed=0    unreachable=0    failed=1  


real    0m4.752s
user    0m4.214s
sys    0m0.336s



The same execution in Ansible 1.7.1 is twice longer :
[ludovic@dc1-se-ifr-ansible-dev ansible]$ time ansible-playbook -v test.yml

PLAY [127.0.0.1] **************************************************************

GATHERING FACTS ***************************************************************
ok: [127.0.0.1]

TASK: [fail ] *****************************************************************
failed: [127.0.0.1] => {"failed": true}
msg: Failed as requested from task

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
           to retry, use: --limit @/home/ludovic/test.retry

127.0.0.1                  : ok=1    changed=0    unreachable=0    failed=1  

real    0m9.259s
user    0m8.409s
sys    0m0.650s


The main consumption time is before the display of "PLAY [127.0.0.1] **************************************************************".
Once the load is done, the execution time of facts gathering and the task is the same.

Has something changed in inventory load or anywhere else that could explain this?

Thanks,

Ludo

Serge van Ginderachter

unread,
Sep 18, 2014, 8:44:12 AM9/18/14
to ansible...@googlegroups.com

On 18 September 2014 14:25, 'Ludovic Petetin' via Ansible Project <ansible...@googlegroups.com> wrote:
Has something changed in inventory load or anywhere else that could explain this?


​Yes. The fact that you notice this might be explained in that you have an extensive inventory, with lots of groups and group_vars etc?

Before 1.7.1, vars for hosts were read at the start of a play where that host is targetted. But group vars were parsed each time again, for every host that were member of a group. This made inialisation for a play tareggting hosts: all painfully slow.
Now, the whole inventory (especially group_vars and host_vars) are parsed in 1 pass, but completely.

This makes it a bit slower to initialize, but makes it lots faster at execution.


Could you time the same test with this playbook?


- hosts: all
  gather_facts: false
  tasks:
    - pause: seconds=0


Ludovic Petetin

unread,
Sep 18, 2014, 10:33:44 AM9/18/14
to ansible...@googlegroups.com
Thanks for the reply. You led me on the right path. We found out that we generate a lot of IPs for our IP addressing plan and it takes a lot of time.

Thanks

Ludo
Reply all
Reply to author
Forward
0 new messages