Ansible Pilot

Ansible troubleshooting - Error sanity

How to Solve the Ansible Error sanity

November 7, 2023
Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons

Understanding the Ansible Playbook Error: sanity

When working with Ansible, it’s essential to ensure the reliability and quality of your code, especially if you are looking for Red Hat Certification. The sanity rule is a specific check that focuses on maintaining a certain level of consistency and best practices when it comes to managing your Ansible codebase.

The Purpose of the sanity Rule

The sanity rule primarily checks a specific file called ignore-x.x.txt. In this file, Ansible developers define “ignores” for various tests, which means they are explicitly exempting certain rules from being enforced. These exemptions are often necessary for practical reasons, but not all exemptions are allowed.

The purpose of the sanity rule is to validate whether the ignores defined in the ignore-x.x.txt file adhere to specific rules and are in line with the best practices advocated by Ansible and the Red Hat Certification process. It enforces a certain level of standardization in your Ansible codebase, ensuring that code quality is maintained.

Error Messages

The sanity rule can produce different error messages when it encounters issues with the ignores defined in the ignore-x.x.txt file:

  1. sanity[cannot-ignore]: This message is triggered when an ignore is defined in the file, but it’s not a permitted ignore according to the set of rules.

  2. sanity[bad-ignore]: When the format of an ignore entry in the file is incorrect or doesn’t follow the required standards, this message is generated.

Currently Allowed Ignores

As of now, the list of allowed ignores for all Ansible versions is relatively limited. These ignores address specific concerns related to Ansible development and best practices. The currently permitted ignores include:

Resolving the sanity Rule Errors

To resolve issues related to the sanity rule, you should carefully review the ignore-x.x.txt file in your Ansible project. Ensure that all the ignores defined in this file are in line with the currently allowed ignores. If you encounter any error messages, make the necessary adjustments to the file so that it complies with the Ansible standards.

It’s important to keep in mind that the sanity rule serves as a check to maintain the quality and consistency of your Ansible codebase, especially when pursuing Red Hat Certification. By adhering to these standards, you not only improve the reliability of your Ansible playbooks but also enhance their compatibility with the wider Ansible community and industry best practices.


In conclusion, the sanity rule in Ansible is a valuable tool for maintaining the quality, consistency, and best practices within your Ansible codebase. This rule is particularly relevant for those seeking Red Hat Certification, as it enforces standards that are essential for compliance and reliable automation.

The sanity rule focuses on verifying the content of the ignore-x.x.txt file, where ignores for various tests are defined. While ignoring certain rules can be necessary for practical reasons, not all exemptions are allowed. This rule ensures that the ignores follow a specific set of standards and are in line with best practices advocated by Ansible.

The error messages generated by the sanity rule provide clear feedback on any issues with the ignores. It indicates whether an ignore is not permitted or if there’s a formatting problem within the ignore-x.x.txt file.

To resolve sanity rule errors, Ansible developers should carefully review and adjust the ignore-x.x.txt file as needed, ensuring that all ignores comply with the currently permitted set. This practice not only enhances the quality of your Ansible playbooks but also aligns your codebase with industry best practices, fostering better compatibility and reliability within the Ansible community.

Ultimately, the sanity rule is a vital component of maintaining the integrity and quality of your Ansible automation projects, making it an essential tool for both certification and overall codebase reliability.

Subscribe to the YouTube channel, Medium, and Website, X (formerly Twitter) to not miss the next episode of the Ansible Pilot.


Learn the Ansible automation technology with some real-life examples in my

My book Ansible By Examples: 200+ Automation Examples For Linux and Windows System Administrator and DevOps

BUY the Complete PDF BOOK to easily Copy and Paste the 250+ Ansible code

Want to keep this project going? Please donate

Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons
Follow me

Subscribe not to miss any new releases