Ansible - Resolve "Error reading config file (ansible.cfg): File contains no section headers"

by
Jeremy Canfield |
Updated: April 12 2021
| Ansible articles
Let's say you are issuing a basic Ansible command, such as ansible --version to display the version of Ansible, and the following is returned.
Error reading config file (/etc/ansible/ansible.cfg): File contains no section headers.
As the error suggests, your ansible.cfg file is missing section headers. Appending [defaults] to line 1 of your ansible.cfg file should resolve this error.
[defaults]
Did you find this article helpful?
If so, consider buying me a coffee over at