Your playbook will stop when a failure occurs and you're using serial: 1
according to the documentation.
By default, Ansible will continue executing actions as long as there are hosts in the group that have not yet failed.
That said there seems to be some confusion in the community over the default behavior, and it seems to have changed--or been buggy--somewhere between 1.8 and 2.1.
So, if serial: 1
doesn't suffice, use this additional setting:
max_failure_percentage: 0
In some situations, such as with the rolling updates described above, it may be desirable to abort the play when a certain threshold of failures have been reached. To achieve this, as of version 1.3 you can set a maximum failure percentage...
==
As for retrying your playbook, you should be seeing a failure message like this:
to retry, use: --limit @/home/user/site.retry
Use that --limit
flag and on your next execution of ansible-playbook
and it will continue from where it failed.
Retry files will be created unless you've set retry_files_enabled = False
in your configuration.
Alternatively, --start-at-task
may also work.
Sources:
https://github.com/ansible/ansible/issues/1663
https://github.com/ansible/ansible/issues/16241
http://docs.ansible.com/ansible/playbooks_delegation.html#rolling-update-batch-size
http://docs.ansible.com/ansible/playbooks_delegation.html#maximum-failure-percentage
http://docs.ansible.com/ansible/intro_configuration.html#retry-files-enabled
http://docs.ansible.com/ansible/playbooks_startnstep.html#start-at-task