Apr 23, 2021 8 min read

RHCE Ansible Series #12: Ansible Troubleshooting

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.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Linux Handbook.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.