luds
luds

Reputation: 331

Ansible Debugger: continue execution when a task fails

I'm aware that the continue command will continue running the playbook, however it will stop running tasks on the failed host. Is there any way to continue running tasks on the host that failed?

https://docs.ansible.com/ansible/latest/user_guide/playbooks_debugger.html

Upvotes: 1

Views: 616

Answers (2)

Juuso Ohtonen
Juuso Ohtonen

Reputation: 9672

A workaround: always skip a task in check mode by adding the following field to a task: ignore_errors: "{{ ansible_check_mode }}"

Upvotes: 0

Calvin Zhou
Calvin Zhou

Reputation: 327

In the task level, if it's likely to be failure, e.g. stop a stopped server, you can indicate "ignore_errors: yes", to tell Ansible it's OK to fail the task and continue, e.g.:

  • name: This task could fail, but it doesn't matter, contiue with next task shell: "stop_server.sh" ignore_errors: yes

While in host level, you already have the configuration to continue

Not sure if that's something you're looking for

Upvotes: 0

Related Questions