Member-only story

Ansible Best Practices: ignore_errors in Ansible Playbooks

Understanding the Consequences of ignore_errors Ansible Directive and the Possible Remediations

Luca Berton
8 min readNov 4, 2023

Introduction

In the realm of IT automation, Ansible is a powerful tool that helps streamline tasks and manage infrastructure efficiently. While Ansible makes automation accessible and user-friendly, it’s essential to follow best practices to ensure the reliability and predictability of your automation workflows. One critical aspect of writing Ansible playbooks is error handling, and that’s where the `ignore_errors` Ansible Lint rule comes into play. This rule checks that playbooks do not use the `ignore_errors` directive to ignore all errors. In this article, we’ll explore the rationale behind this rule and best practices for handling errors in Ansible playbooks.

The Role of `ignore_errors` in Ansible

In Ansible playbooks, the `ignore_errors` directive is employed to instruct Ansible to continue execution even when a task fails. This directive can be beneficial in specific scenarios, but it should be used judiciously. Using `ignore_errors` to bypass all errors across all tasks in a playbook is generally discouraged. Here’s why relying too heavily on `ignore_errors` is problematic:

--

--

Luca Berton
Luca Berton

Written by Luca Berton

I help creative Automation DevOps, Cloud Engineer, System Administrator, and IT Professional to succeed with Ansible Technology to automate more things everyday

No responses yet