11-05-2023 05:19 AM
Hi,
we wrote ansible script to create 200 vlan pool in ACI APIC, but execution is too slow. it take more than one hour to finish the job!
With postman it take 2 minutes to create 200 vlan pool.
how can we improve ansible time execution?
11-05-2023 05:35 AM
Can you post your ansible playbook and ansible.cfg?
11-05-2023 06:57 AM - edited 11-05-2023 07:19 AM
11-05-2023 08:37 AM
Not sure why the execution takes so long, it shouldn't take an hour to complete. Can you post the output when you run the playbook with -vvv ?
You can probably speed up your playbook using async to execute the task in parallel. See the attached file for what that could look like. I am unable to test it ATM, so it might not work - will debug it later if there are errors.
11-06-2023 08:50 AM
Thank you @Torbjørn
adding async 60 and pool 0 to the script reduced time execution to about 4 minutes
the drawback of this method is the result display all tasks in changed state
11-06-2023 07:34 AM
Hey @mzouggagh there is a couple of way this can be sped up which i used in the past (this was with switches and routers)
Also try using modules that are optimized for speed, did find some Ansible modules are optimized for speed, while others are not. Like for example, the aci_fabric module is optimized for speed, while the aci_vlan module is not. I think the reason for the diff in speed here is Postman is a single-threaded application, while Ansible is a multi-threaded application.
Hope this helps.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide