Ansible: [WARNING]: found both a group and a node with the same name

Using the ec2.pyinventory script to query my EC2 instances. I continue to receive the following warning signs. How can I suppress them by correcting the cause of the problem?

[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
+4
source share
2 answers

This is because you probably have the same names in your inventory, for example, this follows the inventory:

[webserver]
webserver
webserver1

We have one host, called webserver and the same name, in a group, it can be a problem when you want to do something for a group web server, what do you think?

, Dynamic Inventory, ec2.py, , , AWS-envinronment, .

+2

, , :

[webserver]
webserver

, :children

:

[webservers]               # <-- 'webservers' is a group
web1
web2

[agent_x]
webservers                 # <-- 'webservers' is a host 

:

[webservers]               # <-- 'webservers' is a group
web1
web2

[agent_x:children]
webservers                 # <-- 'webservers' is a group

ansible 2.4 https://github.com/ansible/ansible/blob/stable-2.4/docs/docsite/rst/intro_inventory.rst#groups-of-groups-and-group-variables

, : children INI : YAML

, hosts groups.

0

Source: https://habr.com/ru/post/1678189/


All Articles