Bug #24090
closedAnsible Callback Script generates duplicate Foreman Host entries
Description
Hi all,
we are using Foreman 1.17.1 with Katello 3.6.0 in combination with Ansible 2.5.2.
When enableing the Foreman setting: "create host on facts upload" and using the foreman callback plugin, which is integrated in ansible, the new foreman hosts are created, when executing an ansible -m setup. This works perfectly fine and ansible keeps updating the hosts facts.
Whenever we execute ansible on "localhost" for example ansible -i localhost, -m setup localhost - it will also create a "localhost" host in foreman.
After executing the ansible setup again, another localhost object is created in foreman with no visible difference other than the foreman host-id.
[root@xxx devel]# hammer host list --organization xxx --search localhost
---|------|------------------|------------|----|-----|--------------|----------------------
ID | NAME | OPERATING SYSTEM | HOST GROUP | IP | MAC | CONTENT VIEW | LIFECYCLE ENVIRONMENT
---|------|------------------|------------|----|-----|--------------|----------------------
[root@xxx devel]# for i in $(seq 1 5);do ansible -i localhost, -m setup localhost --connection=local ;done
[root@xxx devel]# hammer host list --organization xxx--search localhost
-----|---------------------|------------------|------------|-------------|-------------------|--------------|----------------------
ID | NAME | OPERATING SYSTEM | HOST GROUP | IP | MAC | CONTENT VIEW | LIFECYCLE ENVIRONMENT
-----|---------------------|------------------|------------|-------------|-------------------|--------------|----------------------
1841 | localhost.xx.net | RedHat 7.5 | | 10.0.25.200 | 00:50:56:a8:25:60 | |
1842 | localhost.xx.net | RedHat 7.5 | | 10.0.25.200 | 00:50:56:a8:25:60 | |
1849 | localhost.xx.net | RedHat 7.5 | | 10.0.25.200 | 00:50:56:a8:25:60 | |
1852 | localhost.xx.net | RedHat 7.5 | | 10.0.25.200 | 00:50:56:a8:25:60 | |
1855 | localhost.xx.net | RedHat 7.5 | | 10.0.25.200 | 00:50:56:a8:25:60 | |
1858 | localhost.xx.net | RedHat 7.5 | | 10.0.25.200 | 00:50:56:a8:25:60 | |
-----|---------------------|------------------|------------|-------------|-------------------|--------------|----------------------
By using the FQDN we can avoid this issue.
Does anyone have an idea why this happens?
kind regards,
Philipp