When you are testing new plays or debugging playbooks, you may need to run the same play multiple times. To make this more efficient, Ansible offers two alternative ways to execute a playbook: start-at-task and step mode.
To start executing your playbook at a particular task (usually the task that failed on the previous run), use the --start-at-task
option:
ansible-playbook playbook.yml --start-at-task="install packages"
In this example, Ansible starts executing your playbook at a task named “install packages”. This feature does not work with tasks inside dynamically re-used roles or tasks (include_*
), see Comparing includes and imports: dynamic and static re-use.
To execute a playbook interactively, use --step
:
ansible-playbook playbook.yml --step
With this option, Ansible stops on each task, and asks if it should execute that task. For example, if you have a task called “configure ssh”, the playbook run will stop and ask:
Perform task: configure ssh (y/n/c):
Answer “y” to execute the task, answer “n” to skip the task, and answer “c” to exit step mode, executing all remaining tasks without asking.
See also
An introduction to playbooks
Using the Ansible debugger
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/user_guide/playbooks_startnstep.html