There are 4 strategies that can be used.
- debug (same as linear except debug info will be returned)
- free (each managed node will go through the tasks independently, with the goal of completing the playbook as quickly as possible)
- host_pinned (set a limit on the number of managed hosts that will execute the tasks in a playbook simultaneously)
- linear (complete each task on each managed node before moving onto next task)
The ansible-doc command can be used to display documentation on the each strategy.
ansible-doc -t strategy --snippet linear
With the linear strategy, each task is performed against all of the managed nodes (e.g. target systems) before moving onto the next task. For example, let's say the file module is being used to create two directories, /tmp/foo and /tmp/bar. linear is the default strategy, thus there is no need to define linear as the strategy in the playbook.
- hosts: all
- name: mkdir /tmp/foo
- name: mkdir /tmp/bar
Let's say you have 5 managed nodes in your inventory, server1 through server5. In this example, this means that the /tmp/foo directory would be created on server1 through server5 before moving onto the task to create the /tmp/bar directory on server1 through server5.
Optionally, you can define linear as the strategy in ansible.cfg. But this is not required, since linear is the default strategy.
strategy = linear