Foreman ansible callback plugin foreman_callback.py generate duplicate hosts in foreman

Hello,

I have a problem with duplicate hosts in Foreman.

Info: My setup
Foreman = 1.15.2
Foreman_ansible = 1.4.5
ansible = 2.0.0.2

I use the callback plugin foreman_callback.py
as described here ->
Foreman :: Plugin Manuals.

I have configured my foreman and ansible.

Foreman-Settings:
Create new host when Facts are uploaded = Yes
Create new host when reports is uploaded = Yes

If i run on my ansible server:

ansible all -m setup

all is fine the hosts were created correctly in Foreman.
But if i run the ansible command again the host were duplicated.

Please see attachment how is look like.

Has anyone a idea why the foreman_callback.py duplicated the Hosts in
Foreman?

Regards
mobios

Sorry i forgot the attachment. Now i added.

··· >

I think this happens when you don't use the fqdn in ansible hosts file.

As soon as I started using the the correct fqdn I only got one host and no
duplicates.

··· On Wednesday, August 23, 2017 at 11:45:31 AM UTC+2, mobios wrote: > > Hello, > > I have a problem with duplicate hosts in Foreman. > > > Info: My setup > Foreman = 1.15.2 > Foreman_ansible = 1.4.5 > ansible = 2.0.0.2 > > > > I use the callback plugin foreman_callback.py > as described here -> > https://theforeman.org/plugins/foreman_ansible/0.x/index.html. > > I have configured my foreman and ansible. > > Foreman-Settings: > Create new host when Facts are uploaded = Yes > Create new host when reports is uploaded = Yes > > > If i run on my ansible server: > > ansible all -m setup > > all is fine the hosts were created correctly in Foreman. > But if i run the ansible command again the host were duplicated. > > Please see attachment how is look like. > > > > Has anyone a idea why the foreman_callback.py duplicated the Hosts in > Foreman? > > Regards > mobios > > >

> Hello Michael,
>>
>
You are right. Thats was the clue
I changed my inventory file and all works fine.

  Thank you, Thank you, Thank you

  Regards 
  mobios

Just experimented a little more, I think it's your callback version. Will
write more information in the next few days.

··· On Wednesday, August 23, 2017 at 1:05:43 PM UTC+2, Michael Klug wrote: > > I think this happens when you don't use the fqdn in ansible hosts file. > > As soon as I started using the the correct fqdn I only got one host and no > duplicates. > > On Wednesday, August 23, 2017 at 11:45:31 AM UTC+2, mobios wrote: >> >> Hello, >> >> I have a problem with duplicate hosts in Foreman. >> >> >> Info: My setup >> Foreman = 1.15.2 >> Foreman_ansible = 1.4.5 >> ansible = 2.0.0.2 >> >> >> >> I use the callback plugin foreman_callback.py >> as described here -> >> https://theforeman.org/plugins/foreman_ansible/0.x/index.html. >> >> I have configured my foreman and ansible. >> >> Foreman-Settings: >> Create new host when Facts are uploaded = Yes >> Create new host when reports is uploaded = Yes >> >> >> If i run on my ansible server: >> >> ansible all -m setup >> >> all is fine the hosts were created correctly in Foreman. >> But if i run the ansible command again the host were duplicated. >> >> Please see attachment how is look like. >> >> >> >> Has anyone a idea why the foreman_callback.py duplicated the Hosts in >> Foreman? >> >> Regards >> mobios >> >> >>

> Hello Michael,
>>>
>>
thanks for your effort.

       regards
       mobios

I experimeted a lot more and was not able to get consistent results…

I use mainly SLES11.2, 11.3, 11.4 to experiment.

My problem is that sometimes I get duplicate entries if not using fqdn,
sometimes I don't.
Also sometimes OS Model and NICs get correct values and sometimes they
don't.

Comparing the ansible module setup output of servers with different
behavior does not show any obvious difference to me…

I will investigate further :slight_smile:

··· On Wednesday, August 23, 2017 at 2:50:19 PM UTC+2, Michael Klug wrote: > > Just experimented a little more, I think it's your callback version. Will > write more information in the next few days. > > On Wednesday, August 23, 2017 at 1:05:43 PM UTC+2, Michael Klug wrote: >> >> I think this happens when you don't use the fqdn in ansible hosts file. >> >> As soon as I started using the the correct fqdn I only got one host and >> no duplicates. >> >> On Wednesday, August 23, 2017 at 11:45:31 AM UTC+2, mobios wrote: >>> >>> Hello, >>> >>> I have a problem with duplicate hosts in Foreman. >>> >>> >>> Info: My setup >>> Foreman = 1.15.2 >>> Foreman_ansible = 1.4.5 >>> ansible = 2.0.0.2 >>> >>> >>> >>> I use the callback plugin foreman_callback.py >>> as described here -> >>> https://theforeman.org/plugins/foreman_ansible/0.x/index.html. >>> >>> I have configured my foreman and ansible. >>> >>> Foreman-Settings: >>> Create new host when Facts are uploaded = Yes >>> Create new host when reports is uploaded = Yes >>> >>> >>> If i run on my ansible server: >>> >>> ansible all -m setup >>> >>> all is fine the hosts were created correctly in Foreman. >>> But if i run the ansible command again the host were duplicated. >>> >>> Please see attachment how is look like. >>> >>> >>> >>> Has anyone a idea why the foreman_callback.py duplicated the Hosts in >>> Foreman? >>> >>> Regards >>> mobios >>> >>> >>>
1 Like