Skip to main content

Ansible Tutorials for RHCE EX294 Certification Exam

Chapter #12: Ansible Troubleshooting

This is the twelfth and the last chapter of the RHCE Ansible EX294 exam preparation series. You'll learn about troubleshooting Ansible in this article.

We all dream of a world where we never make mistakes or errors while running our Ansible playbooks.

In reality, such world doesn’t exist and so you need to have troubleshooting skills, so you are ready to deal with errors in your playbooks.

In this tutorial, you will learn how to enable logging in your playbooks. You will also learn a few other Ansible modules that can help you with troubleshooting. Finally, you will learn how to troubleshoot connectivity issues in Ansible.

Enable Ansible logging

By default, Ansible is not configured to log its output anywhere. You can however this behavior by setting the log_path configuration setting in your Ansible configuration file (ansible.cfg) to allow Ansible to log its output to a specific destination.

To demonstrate, let’s first set log_path in ansible.cfg:

This would enable Ansible playbooks and ad-hoc commands to log its output to a file named playbooks.log in your project directory.

Ahmed Alkabary
Website Regina,Canada