Project

General

Profile

Actions

Bug #24090

closed

Ansible Callback Script generates duplicate Foreman Host entries

Added by Philipp Mueller over 6 years ago. Updated about 6 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

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


Related issues 1 (0 open1 closed)

Is duplicate of Ansible - Bug #22279: Foreman registers duplicates of host again and again on Ansible callbackClosedOndřej PražákActions
Actions #1

Updated by Martin Angermeier over 6 years ago

  • Related to Bug #22279: Foreman registers duplicates of host again and again on Ansible callback added
Actions #2

Updated by Ondřej Pražák about 6 years ago

  • Status changed from New to Duplicate

Thank you for reporting this, I have managed to reproduce when using partially qualified name of a host. Everything works as expected when using host FQDN, as you have already observed. The problem is that we rely on FQDN to match the uploaded facts and reports to an existing host. I believe it is exactly the same issue as #22279, therefore I will close this as a duplicate. Feel free to reopen if I misunderstood or the fix for #22279 does not resolve the issue for you.

Actions #3

Updated by Ondřej Pražák about 6 years ago

  • Related to deleted (Bug #22279: Foreman registers duplicates of host again and again on Ansible callback)
Actions #4

Updated by Ondřej Pražák about 6 years ago

  • Is duplicate of Bug #22279: Foreman registers duplicates of host again and again on Ansible callback added
Actions

Also available in: Atom PDF