How to ignore errors in Ansible shell

Generally playbooks will stop the execution of any more steps on a host if a task got failed. But in some cases we need to ignore the error and proceed with the remaining.

We can use the following snippets to achieve this.

- name: Ignore error
  command: /bin/false
  ignore_errors: yes

Here the task generating a false and since because of the "ignore_errors: yes", the playbook continues the execution of remaining tasks.

We can use this same method for any bash commands if it requires to ignore the error condition.

That's all…

Leave a Reply