How to continue execution on failed task after fixing error in playbook?

前端 未结 3 757
-上瘾入骨i
-上瘾入骨i 2021-01-31 01:23

When writing and debugging Ansible playbooks, typical workflow is as follows:

  1. ansible-playbook ./main.yaml
  2. Playbook fails on some task
  3. <
3条回答
  •  独厮守ぢ
    2021-01-31 02:19

    Take a look at http://docs.ansible.com/playbooks_startnstep.html. If you want to start executing your playbook at a particular task, you can do so with the --start-at-task option:

    ansible-playbook playbook.yml --start-at-task="install packages"
    

    The above will start executing your playbook at a task named “install packages”.

    Alternatively, take a look at this previous answer How to run only one task in ansible playbook?

    Finally, when a play fails, it usually gives you something along the lines of:

    PLAY RECAP ******************************************************************** 
               to retry, use: --limit @/home/user/site.retry
    

    Use that --limit command and it should retry from the failed task.

提交回复
热议问题