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

前端 未结 3 725
-上瘾入骨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:20

    Future readers:

    The --limit @/home/user/site.retry would not help in such a scenario, the .retry only stores the failed host and nothing more, so will just execute all tasks against failed hosts.

    If you are using the latest version (Ansible 2.x) the --start-at-task does not work for tasks defined inside roles.

    You can achieve similar effect by just using the --step flag e.g: ansible-playbook playbook.yml --step. The step asks you on before executing each task and you could choose (N)o/(y)es/(c)ontinue.

    With this approach you selectively execute tasks when needed and also continue from point where it failed, after fixes.

提交回复
热议问题