On Wed, Feb 28, 2024, at 9:18 AM, Jonathan Rosser wrote:
Hi,
Facts gathering happens once per playbook and at specific points during the execution where a stale facts cache is known to cause errors, it does not occur per task.
The current facts gathering in openstack-ansible is optimised to gather a minimum set of facts to have the least impact on runtime possible.
Jonathan.
There not really any way to escape ansible being relatively slow to execute.
There are things that can be done when writing Ansible to make it run quicker though. For example: avoiding Ansible loops as each loop iteration incurs the overhead of task startup. Unfortunately, Ansible's linter has pushed towards a style that relies on Ansible control flow and modules for execution over say shell scripts that can handle things in a single task avoiding any looping. As a side note the performance in Ansible has gotten worse over time. In particular the per task overhead seems to have skyrocketed. I also think that the -f flag's impact may have been reduced because Ansible stopped preforking processes and instead forks on demand which creates more noticeable overhead. It has been a while since I looked at this closely and it may have since changed again though.
On 28/02/2024 14:44, Gk Gk wrote:
Hi,
Is there any way to speedup the playbooks execution of openstack ansible ? Can we remove gather facts for any tasks without affecting the installation ?