Hosts do not show up in UI but have entries in foreman.hosts database table; using Ansible

After configuring Ansible to send facts to Foreman, I ran Ansible with gather_facts enabled. I see entries in postgreSQL but nothing in the UI of Foreman. Did I skip a setting (Administer > Settings) in Foreman?

I thought maybe somehow Foreman 2.5 requires that I setup subnets or an environment

Expected outcome:
Hosts display as reports/facts are accepted or processed

Foreman and Proxy versions:
Foreman 2.5

Foreman and Proxy plugin versions:
Ansible 2.9.23

Distribution and version:
Ubuntu 20.04.2 LTS

Other relevant data:

Here I see evidence that at least something was received:

2021-07-04T19:44:42 [I|app|d651aa13] Scanning report with: Foreman::PuppetReportScanner, ForemanAnsible::AnsibleReportScanner
2021-07-04T19:44:42 [I|app|d651aa13] Imported report for web-03 in 14.2 ms, status refreshed in 6.6 ms
2021-07-04T19:44:42 [I|app|d651aa13]   Rendering api/v2/config_reports/create.json.rabl
2021-07-04T19:44:42 [I|app|d651aa13]   Rendered api/v2/config_reports/create.json.rabl (Duration: 4.7ms | Allocations: 5981)
2021-07-04T19:44:42 [I|app|d651aa13] Completed 201 Created in 47ms (Views: 5.3ms | ActiveRecord: 9.4ms | Allocations: 25272)

and then I looked at postgres for hints, and I see records were created:

-[ RECORD 2 ]--------+---------------------------
id                   | 4
name                 | web-03
last_compile         | 
last_report          | 2021-07-04 18:31:27.434141
updated_at           | 2021-07-04 18:31:27.522704
created_at           | 2021-07-04 18:25:17.366273
root_pass            | 
architecture_id      | 
operatingsystem_id   | 
environment_id       | 
ptable_id            | 
medium_id            | 
build                | f
comment              | 
disk                 | 
installed_at         | 
model_id             | 
hostgroup_id         | 
owner_id             | 
owner_type           | 
enabled              | t
puppet_ca_proxy_id   | 
managed              | f
use_image            | 
image_file           | 
uuid                 | 
compute_resource_id  | 
puppet_proxy_id      | 
certname             | 
image_id             | 
organization_id      | 
location_id          | 
type                 | Host::Managed
otp                  | 
realm_id             | 
compute_profile_id   | 
provision_method     | 
grub_pass            | 
global_status        | 0
lookup_value_matcher | fqdn=web-03
pxe_loader           | 
initiated_at         | 
build_errors         | 

Try selecting “any organization” and “any location” from the top menu; looks like the hosts were created with no location or organization set.

Ah ha! That was it! Thank you so much! I had tried out Foreman a couple years ago and thought I wrote down all the notes I needed. Missed this UI part.

I’ll look into how “any organization” and “any location” is set via command line or API.

Perhaps you tried it when taxonomy was still optional, so you did not need to care about.

Do you have more than one organization and location created? If not and there is only one it should automatically create the hosts in the organization and location and if this is not the case for ansible I would consider this a bug.

If you have multiple, than the import via report will always be without and you will need hammer, API or GUI to move them to one like you considered (if I remember correctly).

I couldn’t find anything in the database。I couldn’t find any host in the datebase includes the host where the Foreman is installed