Problem:
Using the ansible-foreman callback in AWX to upload results of ansbile facts gathering to Foreman, I have discovered that you can only upload one facts report, and all others get cleaned out.
We have an ansible playbook which does the regular facts gather using the ansible setup module, and also has tasks after that which do package_facts, and service_facts. I have run through several tests and have proven that whichever one runs last is the only data that appears in the facts for the host in Foreman.
We have two environments, and this works fine in one but not in the other.
Expected outcome:
The uploaded facts on the system in Foreman should be an aggregate of all facts on the system including those gathered from Discovery, and the various ansible facts modules individual uploads.
Foreman and Proxy plugin versions:
foreman-1.20.3-1.el7.noarch
tfm-rubygem-facter-2.4.0-6.el7.x86_64
tfm-rubygem-foreman_ansible-2.2.14-1.fm1_20.el7.noarch
tfm-rubygem-foreman_ansible_core-2.1.2-2.fm1_20.el7.noarch
Other relevant data:
production.log during the two facts uploads from ansible:
2019-08-28T18:39:31 [I|app|] Started POST “/api/v2/hosts/facts” for 127.0.0.1 at 2019-08-28 18:39:31 +0000
2019-08-28T18:39:31 [I|app|708fd] Processing by Api::V2::HostsController#facts as JSON
2019-08-28T18:39:31 [I|app|708fd] Parameters: {“facts”=>"[FILTERED]", “name”=>“myhostname.com”, “apiv”=>“v2”, “host”=>{“name”=>“myhostname.com”}}
2019-08-28T18:39:31 [D|app|708fd] Importer Katello::RhsmFactImporter does not implement authorized_smart_proxy_features.
2019-08-28T18:39:31 [D|app|708fd] Current user set to foreman_api_admin (admin)
2019-08-28T18:39:34 [I|app|708fd] Import facts for ‘myhostname.com’ completed. Added: 798, Updated: 0, Deleted 742 facts
2019-08-28T18:39:34 [D|app|708fd] skipping interface with identifier ‘lo’ since it was matched by ‘ignored_interface_identifiers’ setting
2019-08-28T18:39:34 [D|app|708fd] We have following interfaces ‘eth1, eth0’ based on facts
2019-08-28T18:39:34 [D|app|708fd] Body: {“build”:false,“id”:23,“environment_id”:null,“puppet_ca_proxy_id”:null,“puppet_proxy_id”:null,“root_pass”:null,“hostgroup_id”:1,“lookup_value_matcher”:“fqdn=myhostname.com”,“name”
:“myhostname.com”,“last_compile”:“2019-08-28T18:39:31.000Z”,“last_report”:“2019-08-28T19:25:36.000Z”,“updated_at”:“2019-08-28T18:39:34.776Z”,“created_at”:“2019-08-27T20:48:23.405Z”,“architecture_id”:1,“operatingsystem_i
d”:8,“ptable_id”:null,“medium_id”:null,“comment”:null,“disk”:null,“installed_at”:null,“model_id”:1,“owner_id”:29,“owner_type”:“User”,“enabled”:true,“managed”:true,“use_image”:null,“image_file”:"",“uuid”:null,“compute_resource_id”:null,“c
ertname”:“myhostname.com”,“image_id”:null,“organization_id”:18,“location_id”:19,“otp”:null,“realm_id”:null,“compute_profile_id”:null,“provision_method”:“build”,“grub_pass”:"",“global_status”:0,“pxe_loader”:“PXELinux BIO
S”,“initiated_at”:null,“build_errors”:null,“discovery_rule_id”:null,“openscap_proxy_id”:null}
2019-08-28T18:39:34 [I|app|708fd] Completed 201 Created in 3606ms (Views: 3.7ms | ActiveRecord: 916.2ms)
2019-08-28T18:39:42 [I|app|] Started POST “/api/v2/hosts/facts” for 127.0.0.1 at 2019-08-28 18:39:42 +0000
2019-08-28T18:39:42 [I|app|ce243] Processing by Api::V2::HostsController#facts as JSON
2019-08-28T18:39:42 [I|app|ce243] Parameters: {“facts”=>"[FILTERED]", “name”=>“myhostname.com”, “apiv”=>“v2”, “host”=>{“name”=>“myhostname.com”}}
2019-08-28T18:39:42 [D|app|ce243] Importer Katello::RhsmFactImporter does not implement authorized_smart_proxy_features.
2019-08-28T18:39:42 [D|app|ce243] Current user set to foreman_api_admin (admin)
2019-08-28T18:39:43 [I|app|ce243] Import facts for ‘myhostname.com’ completed. Added: 0, Updated: 14, Deleted 0 facts
2019-08-28T18:39:43 [D|app|ce243] skipping interface with identifier ‘lo’ since it was matched by ‘ignored_interface_identifiers’ setting
2019-08-28T18:39:43 [D|app|ce243] We have following interfaces ‘eth1, eth0’ based on facts
2019-08-28T18:39:43 [D|app|ce243] Body: {“build”:false,“id”:23,“environment_id”:null,“puppet_ca_proxy_id”:null,“puppet_proxy_id”:null,“root_pass”:null,“hostgroup_id”:1,“lookup_value_matcher”:“fqdn=myhostname.com”,“name”
:“myhostname.com”,“last_compile”:“2019-08-28T18:39:42.000Z”,“last_report”:“2019-08-28T19:25:36.000Z”,“updated_at”:“2019-08-28T18:39:43.281Z”,“created_at”:“2019-08-27T20:48:23.405Z”,“architecture_id”:1,“operatingsystem_i
d”:8,“ptable_id”:null,“medium_id”:null,“comment”:null,“disk”:null,“installed_at”:null,“model_id”:1,“owner_id”:29,“owner_type”:“User”,“enabled”:true,“managed”:true,“use_image”:null,“image_file”:"",“uuid”:null,“compute_resource_id”:null,“c
ertname”:“myhostname.com”,“image_id”:null,“organization_id”:18,“location_id”:19,“otp”:null,“realm_id”:null,“compute_profile_id”:null,“provision_method”:“build”,“grub_pass”:"",“global_status”:0,“pxe_loader”:“PXELinux BIO
S”,“initiated_at”:null,“build_errors”:null,“discovery_rule_id”:null,“openscap_proxy_id”:null}
2019-08-28T18:39:43 [I|app|ce243] Completed 201 Created in 1065ms (Views: 4.0ms | ActiveRecord: 262.4ms)
2019-08-28T18:39:46 [I|app|] Started POST “/api/v2/hosts/facts” for 127.0.0.1 at 2019-08-28 18:39:46 +0000
2019-08-28T18:39:46 [I|app|8bddd] Processing by Api::V2::HostsController#facts as JSON
2019-08-28T18:39:46 [I|app|8bddd] Parameters: {“facts”=>"[FILTERED]", “name”=>“myhostname.com”, “apiv”=>“v2”, “host”=>{“name”=>“myhostname.com”}}
2019-08-28T18:39:46 [D|app|8bddd] Importer Katello::RhsmFactImporter does not implement authorized_smart_proxy_features.
2019-08-28T18:39:46 [D|app|8bddd] Current user set to foreman_api_admin (admin)
2019-08-28T18:39:49 [I|app|8bddd] Import facts for ‘myhostname.com’ completed. Added: 742, Updated: 0, Deleted 798 facts
2019-08-28T18:39:49 [D|app|8bddd] Ansible facts parser: No OS could be created with os_name=’’ os_major=’’ os_minor=’’: #ActiveModel::Errors:0x00007f90e323fae8
2019-08-28T18:39:49 [D|app|8bddd] We have following interfaces ‘’ based on facts
2019-08-28T18:39:49 [D|app|8bddd] Body: {“build”:false,“id”:23,“name”:“myhostname.com”,“environment_id”:null,“puppet_ca_proxy_id”:null,“puppet_proxy_id”:null,“root_pass”:null,“hostgroup_id”:1,“lookup_value_matcher”:“fqd
n=myhostname.com”,“last_compile”:“2019-08-28T18:39:46.000Z”,“last_report”:“2019-08-28T19:25:36.000Z”,“updated_at”:“2019-08-28T18:39:49.165Z”,“created_at”:“2019-08-27T20:48:23.405Z”,“architecture_id”:1,“operatingsystem_i
d”:8,“ptable_id”:null,“medium_id”:null,“comment”:null,“disk”:null,“installed_at”:null,“model_id”:1,“owner_id”:29,“owner_type”:“User”,“enabled”:true,“managed”:true,“use_image”:null,“image_file”:"",“uuid”:null,“compute_resource_id”:null,“c
ertname”:“myhostname.com”,“image_id”:null,“organization_id”:18,“location_id”:19,“otp”:null,“realm_id”:null,“compute_profile_id”:null,“provision_method”:“build”,“grub_pass”:"",“global_status”:0,“pxe_loader”:“PXELinux BIO
S”,“initiated_at”:null,“build_errors”:null,“discovery_rule_id”:null,“openscap_proxy_id”:null}
2019-08-28T18:39:49 [I|app|8bddd] Completed 201 Created in 2632ms (Views: 3.8ms | ActiveRecord: 792.0ms)