Let's consider the scenario where Ansible is being used to perform two (or more) tasks on managed nodes (e.g. target systems). For example, let's say the file module is being used to create two directories, /tmp/foo and /tmp/bar.
- name: "mkdir /tmp/foo" file: path: "/tmp/foo" state: directory - name: "mkdir /tmp/bar" file: path: "/tmp/bar" state: directory
By default, Ansible uses the linear strategy, which means that each task is performed against the targetted managed nodes before moving onto the next task. In this example, this would mean that the /tmp/foo directory would be created on the targetted managed nodes before moving onto the task to create the /tmp/bar directory on the managed nodes.
Alternatively, the free strategy can be used to perform each tasks as quickly on possible on each managed node, and to move onto next tasks while prior tasks are still being implemented on the targetted managed nodes.
You may also want to use the ansible-doc command to display documentation on the linear strategy.
Since linear is the default strategy, there is no need to explicitely define linear as the strategy. However, this can be done like this, if needed.
- name: "mkdir /tmp/foo" file: path: "/tmp/foo" state: directory strategy: linear
Or, you can define linear as the strategy in ansible.cfg, like this.
strategy = linear