[Ansible] Facts upload creates new host

Problem:
I have a host, let’s name it “some-server” which has two interfaces:

  • One for provisioning (DNS: some-server)
  • One for remote execution (DNS: some-server-remote)

After a host’s facts are uploaded, a new host “some-server-remote” is created, containing the facts I hoped to see in the “some-server” host.

Expected outcome:
The system traverses the hosts to check if the hostname isn’t registered on a different interface, before attempting to create a new host.

Foreman and Proxy versions:
1.20.1

Foreman and Proxy plugin versions:
Foreman Ansible: 2.2.11
Proxy Ansible: 2.0.3
foreman_remote_execution: 1.6.7
Proxy SSH: 0.2.0

Other relevant data:

2019-01-04T10:43:40 [I|app|] Started POST "/api/v2/hosts/facts" for 10.30.6.4 at 2019-01-04 10:43:40 +0000
2019-01-04T10:43:40 [I|app|b7726] Processing by Api::V2::HostsController#facts as JSON
2019-01-04T10:43:40 [I|app|b7726]   Parameters: {"facts"=>"[FILTERED]", "name"=>"some-server-remote", "apiv"=>"v2", "host"=>{"name"=>"some-server-remote"}}
2019-01-04T10:43:40 [I|app|b7726] Import facts for 'some-server-remote' completed. Added: 1, Updated: 0, Deleted 1 facts
2019-01-04T10:43:40 [I|app|b7726] Completed 201 Created in 167ms (Views: 4.6ms | ActiveRecord: 90.7ms)
1 Like

I’m experiencing the same issue.

Yes, definitely a bug. Thanks for reporting it.

https://projects.theforeman.org/issues/25803

2 Likes

Will you be working on this? As I actually noticed another bug in the fact reporting and I’ll see to fix that issue; might take a look at issue 25803 as well? Unless you’re already investigating that one ofcourse :slight_smile:

1 Like

Go, ahead, I haven’t started working on it yet, I just tried to reproduce to get the exact reproducer steps and created a ticket in Redmine.

For people interested in this topic, I’ve updated the issue with my preliminary research. Although I’d be curious to learn if anyone has other environments in which they could test the same scenario? I’m looking a puppet (probably works), chef, salt environments? Perhaps this is specific to ansible but I’m unsure which “name” is used by the fact-sender when they make the API call (could review, but perhaps some of you have experience with these?)

Preliminary findings can be read on: Bug #25803: Duplicate hosts from facts when running Ansible on secondary interface - Ansible - Foreman