summaryrefslogtreecommitdiffstats
path: root/docs/docsite/rst/playbook_guide/playbooks_startnstep.rst
blob: e6c78d24edd40ef688a52a9528d0f635f0d2d5b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
.. _playbooks_start_and_step:

***************************************
Executing playbooks for troubleshooting
***************************************

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.

.. _start_at_task:

start-at-task
-------------

To start executing your playbook at a particular task (usually the task that failed on the previous run), use the ``--start-at-task`` option.

.. code-block:: shell

    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 :ref:`dynamic_vs_static`.

.. _step:

Step mode
---------

To execute a playbook interactively, use ``--step``.

.. code-block:: shell

    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.

.. code-block:: shell

    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.

.. seealso::

   :ref:`playbooks_intro`
       An introduction to playbooks
   :ref:`playbook_debugger`
       Using the Ansible debugger