Ansible execution is versatile enough that we can modify how and when tasks are executed. The settings can be made globally or at the play level.
| Execution Strategies | Explanation | Example |
| linear | This is the default. The task is executed simultaneously against all the hosts using the forks, and then the next series of hosts until the batch is done before going to the next task | At ansible.cfg …. [defaults] strategy = linear Or at Play Level – name: web servers hosts: webservers strategy: linear |
| debug | Task execution is like the linear strategy, but controlled by an interactive debug session | At ansible.cfg …. [defaults] strategy = debug Or at Play Level – name: web servers hosts: webservers strategy: debug |
| free | Ansible will not wait for other hosts to finish before queueing for more tasks on other hosts. It prevents blocking new tasks for hosts that have already completed. | At ansible.cfg …. [defaults] strategy = free Or at Play Level – name: web servers hosts: webservers strategy: free |
References:
- Red Hat Certified Engineer (RHCE) Ansible Automation Study Guide (Alexc Soto Bueno)