Easiest way to exit Ansible playbook while debugging
Solution 1:
- meta: end_play
end_play
(added in 2.2) causes the play to end without failing the host.
Solution 2:
Using - pause:
might suit.
Pauses playbook execution for a set amount of time, or until a prompt is acknowledged. All parameters are optional. The default behavior is to pause with a prompt. You can use
ctrl+c
if you wish to advance a pause earlier than it is set to expire or if you need to abort a playbook run entirely. To continue early: pressctrl+c
and thenc
. To abort a playbook: pressctrl+c
and thena
.
http://docs.ansible.com/pause_module.html
Or just a straight - fail:
if you will certainly not want to continue.
If you want a block of tasks to execute, you can use tags and --with-tags:
. Ansible v2 will have proper code blocks so you can use a single when:
for multiple tasks.
Solution 3:
ansible-playbook --step
will let you confirm each task you want to run and stop execution whenever you want.