Hello,

While doing work to get our playbooks, tasks, roles, and callbacks all 
compatible with Ansible 2.x, I've noticed an inherent slowness in which the 
playbooks take to complete on Ansible 2.x.  Today I had some time trying to 
tweak things to try to ensure Ansible 2.x is performing as fast as 
possible.  There are times we are pushing Ansible to hundreds of hosts and 
these additional seconds can really add up when pushing multiple roles. 
 I've finally narrowed down the issue to how we are "chain-loading" a total 
of 66 roles from one role called common in the main.yml of the meta folder. 
 We use this to keep the playbooks clean, as well a way to ensure all the 
roles we define in meta of common get played out in our various playbooks 
with just one line.  We only push the playbook when we first provision a 
host and often use tags defined on the roles in common's meta as a way to 
specifically target a role we are interested in.  I did find one bug 
(https://github.com/ansible/ansible/issues/14112) that has been issued and 
seems related.  I applied the patch and that seems to help but performance 
is still not the greatest.  Below are my timings of our dns role that has 
six tasks using the following modules: Template, Stat, File, and Copy. 
 There were a total of 6 hosts that I was hitting, and to optimize for 
speed, I forked out ansible-playbook by 6.  I played out four tests: 1) all 
roles listed in our "shell" role common as dependencies, 2) Same as 1 with 
the patch I found relating to inter-dependency slowness, 3) moving all the 
roles directly to the playbook from common's meta main.yml, and 4) only 
adding the dns role to the playbook.  The speed of Ansible 2.x 
significantly increase as I made my way from from scenario 1 to scenario 4. 
 Since this has pretty good speeds on Ansbile 1.9.2 should I be expecting 
similar speeds? Is this a known issue?  Below I provided my timings from 
the same command across the different scenarios.

All roles listed in meta of common 
time ansible-playbook -f6 -i hosts-nixtest -t dns playbook-common.yml 
*Version* *User* *System* *Total* 
1.9.2 5.35 1.3 5.152 
2.0.2 13.76 2.96 12.093 
2.1.0 13.46 2.87 12.472 




All roles listed in meta of common 
time ansible-playbook -f6 -i hosts-nixtest -t dns playbook-common.yml 
Patched with https://github.com/ansible/ansible/issues/14112 
*Version* *User* *System* *Total* 
1.9.2 5.95 1.3 6.287 
2.0.2 12.76 2.68 10.869 
2.1.0 13.29 2.87 11.872 
2.1.0 (Patched) 9.1 2.51 10.71 




Moved dependencies listed in meta of common role to the playbook 
time ansible-playbook -f6 -i hosts-nixtest -t dns playbook-common.yml 
*Version* *User* *System* *Total* 
1.9.2 5.94 1.36 6.703 
2.0.2 5.36 2.09 8.654 
2.1.0 5.83 2.34 8.774 




Just the single DNS role in playbook 
time ansible-playbook -f6 -i hosts-nixtest -t dns playbook-common.yml 
*Version* *User* *System* *Total* 
1.9.2 5.58 1.37 5.956 
2.0.2 4.39 2.69 16.978 
2.1.0 2.89 2.03 5.341 
Thanks,

Chris

-- 
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/a21f6e8d-0a0c-4a74-b7a6-a3178b6fcf1c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to