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
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
.