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,260 points

edited Jul 28, 2020 by MD 15,475 views

1 answer to this question.

0 votes

Hi@akhtar,

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
[defaults]
inventory = /etc/myhosts.txt

I hope this will help.

answered Jul 28, 2020 by MD
• 95,460 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
4,059 views
+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,460 points
15,222 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP