Ansible Don’t Wait All Hosts To Complete A Task

Published on Author gryzli

Sometimes you don’t want to wait all hosts to complete a task, before going to the next one in Ansible.


For example you have the the following scenario

1) Stop web server

2) Do some magic  (takes different time on different hosts)

3) Start web server


You don’t want your web servers to be down, until all of your hosts execute step 2) , because somewhere it could take a lot of time.

In this case you can tell Ansible to execute tasks per host and to disregard whether all hosts have been executed the same task.

This is done by using strategy: free and here is an example:

- hosts: all
  strategy: free

More information about ansible strategies could be found here: