To ignore errors use the attribute ignore_errors as the following example.
- name: be sure ntp is installed yum: name: ntp state: installed ignore_errors: yes
For don’t stop the execution when an error is faced the attribute force_handlers can be used. Following an example.
--- hosts: all force_handlers: yes tasks: - name: web server is enabled service: name: httpd enabled: true
Conditional to fail
By the attribute, failed_when is possible to force the playbook stop/fail when some conditional occurs. Following an example.
tasks: - shell: /usr/local/bin/myshell.sh register: shell_result failed_when: "'Not found' in shell_result.stdout"
For further information see the Error Handling In Playbooks documentation.