Error reading config file etc ansible ansible cfg File contains no section headers

0 votes

Hi Guys,

I am trying to list down all the hosts from the inventory file. But it is showing me the below error.

[root@localhost ~]# ansible all --list-hosts
Error reading config file (/etc/ansible/ansible.cfg): File contains no section headers.
file: '<string>', line: 1
'inventry = /etc/myhosts.txt\n'

I have attached the ansible.cfg file below.

inventory = /etc/myhosts.txt

Jul 28, 2020 in Ansible by akhtar
• 38,210 points

edited Jul 28, 2020 by MD 3,206 views

1 answer to this question.

0 votes


You need to add one tag in your ansible.cfg file. Make changes in your ansible.cfg file as shown below.

[root@localhost ~]# vim /etc/ansible/ansible.cfg
inventory = /etc/myhosts.txt

I hope this will help.

answered Jul 28, 2020 by MD
• 95,320 points

Related Questions In Ansible

0 votes
1 answer
0 votes
1 answer
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
+2 votes
1 answer
0 votes
1 answer

No match for argument: ansible Error: Unable to find a match

Hi@akhtar, Ansible is not part of your RedHat ...READ MORE

answered Jul 28, 2020 in Ansible by MD
• 95,320 points