Reputation: 10376
Using the ec2.py
inventory script to query against my EC2 instances. I keep getting the following warning signs. How can i suppress them by fixing what's causing the issue?
[WARNING]: Found both group and host with same name: nex-1.XYZ.net
[WARNING]: Found both group and host with same name: admin-1.XYZ.net
[WARNING]: Found both group and host with same name: jenkinsmaster-1.XYZ.net
Upvotes: 19
Views: 19288
Reputation: 1
Solved this problem in a very simple way: i forgot to add :children after my groupname
Upvotes: 0
Reputation: 831
Spotting the reuse of the same name as host and group is easy :
[webserver]
webserver
But it might be trickier because sometimes it's just you have forgotten to add the :children
in your group definition
This definition will rise a Warning :
[webservers] # <-- 'webservers' is a group
web1
web2
[agent_x]
webservers # <-- 'webservers' is a host
While this one won't :
[webservers] # <-- 'webservers' is a group
web1
web2
[agent_x:children]
webservers # <-- 'webservers' is a group
Quote from ansible 2.4 documentation https://github.com/ansible/ansible/blob/stable-2.4/docs/docsite/rst/intro_inventory.rst#groups-of-groups-and-group-variables
It is also possible to make groups of groups using the :children suffix in INI or the children: entry in YAML
Meaning you have to be explicit whether the group will list hosts
or groups
.
Upvotes: 18
Reputation: 4122
It happens because you probably have the same names into your inventory, for example this follow inventory:
[webserver]
webserver
webserver1
We have one host called webserver and the same name into group, could be a problem when you want to do something to group webserver don't you think?
If it happens when you use Dynamic Inventory like ec2.py the name probably is duplicated into your AWS envinronment, I recommend you change this.
Upvotes: 3