![]() ![]() Configure parallelismĪnsible uses batches for task execution, which are controlled by a parameter called forks. The more nodes you have, the more time you save by disabling fact gathering. Node1: ok=8 changed=4 unreachable=0 failed=0 With gather_facts: False disabling fact gathering, performance increases: $ time ansible-playbook site.yml With gathering facts enabled: $ time ansible-playbook site.yml You can disable this operation by setting gather_facts: False in the play. But if you're not using these details in your playbook anywhere, then this is a waste of time. This gathers information about the remote node you're automating, and the details are available under the variable ansible_facts. When a playbook executes, each play runs a hidden task, called gathering facts, using the setup module. This information helps you identify which task takes more time than the others. The output details the time it took for each task, role, and so on. Gathering Facts - 1.60sĭeploy-web-server : Enable and Run Firewalld - 0.82sĭeploy-web-server : firewalld permitt httpd service - 0.72sĭeploy-web-server : httpd enabled and running - 0.55sĭeploy-web-server : Set Hostname on Site - 0.54sĭeploy-web-server : Delete content & directory - 0.52sĭeploy-web-server : Create directory - 0.41sĭeploy Web service - 0.04s Playbook run took 0 days, 0 hours, 0 minutes, 14 seconds Node1: ok=9 changed=4 unreachable=0 failed=0 Now execute the ansible-playbook command: $ ansible-playbook site.yml ![]() You can enable callback plugins such as timer, profile_tasks, and profile_roles to find a task's time consumption and identify which jobs are slowing down your plays.Ĭonfigure ansible.cfg with the plugins: Ĭallbacks_enabled = timer, profile_tasks, profile_roles Identify slow tasks with callback pluginsĪ specific task in a playbook might look simple, but it can be why the playbook is executing slowly. This article covers some of the major optimization methods available in Ansible for speeding up playbook execution. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |