Project

General

Profile

Actions

Bug #24090

closed

Ansible Callback Script generates duplicate Foreman Host entries

Added by Philipp Mueller almost 7 years ago. Updated over 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

Also available in: Atom PDF