I started over with a fresh RHEL7 VM and went through all installation
steps again to make sure there was nothing I missed. Same results.
This time yum picked up ansible-2.3.0.0-3.el7.noarch from EPEL. This
version appears to come with its own callback foreman.py. I have tried
this version and foreman_callback.py both in the location provided by
ansible from EPEL (/usr/lib/python2.7/site-
packages/ansible/plugins/callback/foreman.py) and in a separate directory I
created just to isolate them (yes I updated ansible.cfg whenever I moved
the callback scripts).
It appears that the host is stored in the database (or a file) because i
regularly see this in production.log:
2017-05-02 13:32:34 f6afba3a [app] [I] Started GET
"/node/hostname.domain.com?format=yml" for 10.121.66.130 at 2017-05-02
13:32:34 -0500
2017-05-02 13:32:34 f6afba3a [app] [I] Processing by
HostsController#externalNodes as YML
2017-05-02 13:32:34 f6afba3a [app] [I] Parameters:
{"name"=>"hostname.domain.com"}
2017-05-02 13:32:34 f6afba3a [app] [I] Rendered text template (0.0ms)
2017-05-02 13:32:34 f6afba3a [app] [I] Completed 200 OK in 107ms (Views:
0.7ms | ActiveRecord: 10.0ms)
2017-05-02 13:32:35 76fb48ea [app] [I] Started POST "/api/hosts/facts" for
10.121.66.130 at 2017-05-02 13:32:35 -0500
2017-05-02 13:32:35 76fb48ea [app] [I] Processing by
Api::V2::HostsController#facts as JSON
2017-05-02 13:32:35 76fb48ea [app] [I] Parameters:
{"facts"=>"[FILTERED]", "name"=>"hostname.domain.com",
"certname"=>"hostname.domain.com", "apiv"=>"v2",
:host=>{"certname"=>"hostname.domain.com", "name"=>"hostname.domain.com"}}
2017-05-02 13:32:35 76fb48ea [audit] [I] [hostname.domain.com] deleted 0
(8.1ms)
2017-05-02 13:32:35 76fb48ea [audit] [I] [hostname.domain.com] updated 15
(437.0ms)
2017-05-02 13:32:35 76fb48ea [audit] [I] [hostname.domain.com] added 0
(2.9ms)
2017-05-02 13:32:35 76fb48ea [app] [I] Import facts for
'hostname.domain.com' completed. Added: 0, Updated: 15, Deleted 0 facts
2017-05-02 13:32:35 76fb48ea [app] [I] Completed 201 Created in 534ms
(Views: 3.6ms | ActiveRecord: 69.7ms)
2017-05-02 13:32:35 7f153fdf [app] [I] Started GET
"/node/hostname.domain.com?format=yml" for 10.121.66.130 at 2017-05-02
13:32:35 -0500
2017-05-02 13:32:35 7f153fdf [app] [I] Processing by
HostsController#externalNodes as YML
2017-05-02 13:32:35 7f153fdf [app] [I] Parameters:
{"name"=>"hostname.domain.com"}
2017-05-02 13:32:35 7f153fdf [app] [I] Rendered text template (0.0ms)
2017-05-02 13:32:35 7f153fdf [app] [I] Completed 200 OK in 80ms (Views:
0.5ms | ActiveRecord: 7.0ms)
2017-05-02 13:32:36 4fccfb22 [app] [I] Started POST "/api/config_reports"
for 10.121.66.130 at 2017-05-02 13:32:36 -0500
2017-05-02 13:32:36 4fccfb22 [app] [I] Processing by
Api::V2::ConfigReportsController#create as JSON
2017-05-02 13:32:36 4fccfb22 [app] [I] Parameters:
{"config_report"=>"[FILTERED]", "apiv"=>"v2"}
2017-05-02 13:32:36 4fccfb22 [app] [I] processing report for
hostname.domain.com
2017-05-02 13:32:36 4fccfb22 [app] [I] Imported report for
hostname.domain.com in 0.04 seconds
2017-05-02 13:32:36 4fccfb22 [app] [I] Rendered
api/v2/config_reports/create.json.rabl (10.5ms)
2017-05-02 13:32:36 4fccfb22 [app] [I] Completed 201 Created in 80ms
(Views: 10.9ms | ActiveRecord: 13.4ms)
And yet, still the Hosts tab in the Foreman GUI is empty. Thanks again,
Jarret
On Wednesday, April 19, 2017 at 1:57:40 PM UTC-5, J Webb wrote:
>
> Greetings,
>
> I have been unable to add hosts using "ansible -m setup hostname".
>
> I have recently installed Foreman 1.14.3 with the Katello scenario and the
> Ansible plugin v 2.2.1.0 using "foreman-installer --scenario=katello
> --enable-foreman-plugin-ansible". Everything seems to be working fine
> except for no hosts are showing up using Ansible.
>
> I have successfully run a playbook on this host and followed these
> instructions:
> https://theforeman.org/plugins/foreman_ansible/1.x/index.html
>
> Here are the relevant config changes:
>
> /usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.py:
>
> FOREMAN_URL = os.getenv('FOREMAN_URL', "https://localhost")
>
> /etc/ansible/ansible.cfg:
> [defaults]
> callback_whitelist = foreman
> ...
> callback_plugins =
> /usr/lib/python2.7/site-packages/ansible/plugins/callback
> ...
> bin_ansible_callbacks = True
>
> The host I'm trying to set up is in trusted_puppetmaster_hosts in Foreman
>
> ignore_puppet_facts_for_provisioning = No
>
> RESULTS:
>
> Running "ansible -m setup hostname" returns no errors, just a lot of
> system info to stdout. Here are the foreman production.log entries during
> the setup:
>
> 2017-04-19 12:53:09 58d05530 [app] [I] Started POST "/api/v2/hosts/facts"
> for 10.121.66.130 at 2017-04-19 12:53:09 -0500
> 2017-04-19 12:53:09 58d05530 [app] [I] Processing by
> Api::V2::HostsController#facts as JSON
> 2017-04-19 12:53:09 58d05530 [app] [I] Parameters:
> {"facts"=>"[FILTERED]", "name"=>"hostname.domain.com", "apiv"=>"v2",
> :host=>{"name"=>"hostname.domain.com"}}
> 2017-04-19 12:53:09 58d05530 [audit] [I] [hostname.domain.com] deleted 0
> (15.0ms)
> 2017-04-19 12:53:10 58d05530 [audit] [I] [hostname.domain.com] updated 18
> (594.4ms)
> 2017-04-19 12:53:10 58d05530 [audit] [I] [hostname.domain.com] added 0
> (6.2ms)
> 2017-04-19 12:53:10 58d05530 [app] [I] Import facts for '
> hostname.domain.com' completed. Added: 0, Updated: 18, Deleted 0 facts
> 2017-04-19 12:53:10 58d05530 [app] [I] Completed 201 Created in 755ms
> (Views: 4.0ms | ActiveRecord: 103.9ms)
> 2017-04-19 12:53:10 c522a2fd [app] [I] Started POST "/api/v2/hosts/facts"
> for 10.121.66.130 at 2017-04-19 12:53:10 -0500
> 2017-04-19 12:53:10 c522a2fd [app] [I] Processing by
> Api::V2::HostsController#facts as JSON
> 2017-04-19 12:53:10 c522a2fd [app] [I] Parameters:
> {"facts"=>"[FILTERED]", "name"=>"hostname.domain.com", "apiv"=>"v2",
> :host=>{"name"=>"hostname.domain.com"}}
> 2017-04-19 12:53:10 c522a2fd [audit] [I] [hostname.domain.com] deleted 0
> (18.9ms)
> 2017-04-19 12:53:10 c522a2fd [audit] [I] [hostname.domain.com] updated 0
> (532.0ms)
> 2017-04-19 12:53:10 c522a2fd [audit] [I] [hostname.domain.com] added 0
> (6.4ms)
> 2017-04-19 12:53:10 c522a2fd [app] [I] Import facts for '
> hostname.domain.com' completed. Added: 0, Updated: 0, Deleted 0 facts
> 2017-04-19 12:53:10 c522a2fd [app] [I] Completed 201 Created in 687ms
> (Views: 8.6ms | ActiveRecord: 94.1ms)
>
> Any advice is greatly appreciated.
>
> Jarret
>
--
You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.