I also ran a simple playbook after seeing that solve this issue for
someone, I added the "gather_facts: yes" directive in the yaml file for my
host and still it does not show up in Foreman. However when running this
playbook there are 3 errors now in the production.log:
2017-04-20 22:58:07 5ed25d05 [app] [E] Unprocessable entity ConfigReport
(id: new):
2017-04-20 22:58:07 beef70f9 [app] [E] Unprocessable entity ConfigReport
(id: new):
2017-04-20 22:58:07 3eddb29b [app] [E] Unprocessable entity ConfigReport
(id: new):
Full output of the run is attached. FWIW I am running ansible
2.2.1.0-1.el7 from EPEL which is providing /etc/ansible and
/usr/lib/python2.7/site-
packages/ansible/plugins/callback. Thanks again everyone...
JW
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.
2017-04-20 22:58:02 977f045a [app] [I] Started POST "/api/v2/hosts/facts" for
10.121.66.130 at 2017-04-20 22:58:02 -0500
2017-04-20 22:58:03 977f045a [app] [I] Processing by
Api::V2::HostsController#facts as JSON
2017-04-20 22:58:03 977f045a [app] [I] Parameters: {"facts"=>"[FILTERED]",
"name"=>"hostname.domain.com", "apiv"=>"v2",
:host=>{"name"=>"hostname.domain.com"}}
2017-04-20 22:58:03 977f045a [audit] [I] [hostname.domain.com] deleted 0
(17.8ms)
2017-04-20 22:58:03 977f045a [audit] [I] [hostname.domain.com] updated 13
(649.0ms)
2017-04-20 22:58:03 977f045a [audit] [I] [hostname.domain.com] added 0 (3.5ms)
2017-04-20 22:58:03 977f045a [app] [I] Import facts for 'hostname.domain.com'
completed. Added: 0, Updated: 13, Deleted 0 facts
2017-04-20 22:58:03 977f045a [app] [I] Completed 201 Created in 785ms (Views:
7.2ms | ActiveRecord: 113.3ms)
2017-04-20 22:58:03 58a44226 [app] [I] Started POST "/api/v2/hosts/facts" for
10.121.66.130 at 2017-04-20 22:58:03 -0500
2017-04-20 22:58:03 58a44226 [app] [I] Processing by
Api::V2::HostsController#facts as JSON
2017-04-20 22:58:03 58a44226 [app] [I] Parameters: {"facts"=>"[FILTERED]",
"name"=>"hostname.domain.com", "apiv"=>"v2",
:host=>{"name"=>"hostname.domain.com"}}
2017-04-20 22:58:03 58a44226 [audit] [I] [hostname.domain.com] deleted 0
(20.7ms)
2017-04-20 22:58:04 58a44226 [audit] [I] [hostname.domain.com] updated 0
(598.5ms)
2017-04-20 22:58:04 58a44226 [audit] [I] [hostname.domain.com] added 0 (3.0ms)
2017-04-20 22:58:04 58a44226 [app] [I] Import facts for 'hostname.domain.com'
completed. Added: 0, Updated: 0, Deleted 0 facts
2017-04-20 22:58:04 58a44226 [app] [I] Completed 201 Created in 735ms (Views:
3.9ms | ActiveRecord: 97.1ms)
2017-04-20 22:58:04 b132151f [app] [I] Started POST "/api/v2/hosts/facts" for
10.121.66.130 at 2017-04-20 22:58:04 -0500
2017-04-20 22:58:04 b132151f [app] [I] Processing by
Api::V2::HostsController#facts as JSON
2017-04-20 22:58:04 b132151f [app] [I] Parameters:
{"name"=>"hostname.domain.com", "facts"=>"[FILTERED]", "apiv"=>"v2",
:host=>{"name"=>"hostname.domain.com"}}
2017-04-20 22:58:04 b132151f [audit] [I] [hostname.domain.com] deleted 0
(22.5ms)
2017-04-20 22:58:05 b132151f [audit] [I] [hostname.domain.com] updated 0
(522.9ms)
2017-04-20 22:58:05 b132151f [audit] [I] [hostname.domain.com] added 0 (4.2ms)
2017-04-20 22:58:05 b132151f [app] [I] Import facts for 'hostname.domain.com'
completed. Added: 0, Updated: 0, Deleted 0 facts
2017-04-20 22:58:05 b132151f [app] [I] Completed 201 Created in 674ms (Views:
3.9ms | ActiveRecord: 87.5ms)
2017-04-20 22:58:05 7f721746 [app] [I] Started POST "/api/v2/hosts/facts" for
10.121.66.130 at 2017-04-20 22:58:05 -0500
2017-04-20 22:58:05 7f721746 [app] [I] Processing by
Api::V2::HostsController#facts as JSON
2017-04-20 22:58:05 7f721746 [app] [I] Parameters:
{"name"=>"hostname.domain.com", "facts"=>"[FILTERED]", "apiv"=>"v2",
:host=>{"name"=>"hostname.domain.com"}}
2017-04-20 22:58:05 7f721746 [audit] [I] [hostname.domain.com] deleted 0
(15.0ms)
2017-04-20 22:58:06 7f721746 [audit] [I] [hostname.domain.com] updated 0
(746.4ms)
2017-04-20 22:58:06 7f721746 [audit] [I] [hostname.domain.com] added 0 (3.4ms)
2017-04-20 22:58:06 7f721746 [app] [I] Import facts for 'hostname.domain.com'
completed. Added: 0, Updated: 0, Deleted 0 facts
2017-04-20 22:58:06 7f721746 [app] [I] Completed 201 Created in 892ms (Views:
4.8ms | ActiveRecord: 114.9ms)
2017-04-20 22:58:07 22fc594a [app] [I] Started POST "/api/v2/reports" for
10.121.66.130 at 2017-04-20 22:58:07 -0500
2017-04-20 22:58:07 22fc594a [app] [I] Processing by
Api::V2::ReportsController#create as JSON
2017-04-20 22:58:07 22fc594a [app] [I] Parameters: {"report"=>"[FILTERED]",
"apiv"=>"v2"}
2017-04-20 22:58:07 22fc594a [app] [I] processing report for hostname.domain.com
2017-04-20 22:58:07 22fc594a [app] [I] Imported report for hostname.domain.com
in 0.08 seconds
2017-04-20 22:58:07 22fc594a [app] [I] Rendered
api/v2/reports/create.json.rabl (14.8ms)
2017-04-20 22:58:07 22fc594a [app] [I] Completed 201 Created in 137ms (Views:
13.7ms | ActiveRecord: 25.3ms)
2017-04-20 22:58:07 5ed25d05 [app] [I] Started POST "/api/v2/reports" for
10.121.66.130 at 2017-04-20 22:58:07 -0500
2017-04-20 22:58:07 5ed25d05 [app] [I] Processing by
Api::V2::ReportsController#create as JSON
2017-04-20 22:58:07 5ed25d05 [app] [I] Parameters: {"report"=>"[FILTERED]",
"apiv"=>"v2"}
2017-04-20 22:58:07 5ed25d05 [app] [I] processing report for hostname.domain.com
2017-04-20 22:58:07 5ed25d05 [app] [E] Unprocessable entity ConfigReport (id:
new):
| Report time has already been taken
|
2017-04-20 22:58:07 5ed25d05 [app] [I] Rendered
api/v2/errors/unprocessable_entity.json.rabl within api/v2/layouts/error_layout
(1.9ms)
2017-04-20 22:58:07 5ed25d05 [app] [I] Completed 422 Unprocessable Entity in
44ms (Views: 3.5ms | ActiveRecord: 5.5ms)
2017-04-20 22:58:07 beef70f9 [app] [I] Started POST "/api/v2/reports" for
10.121.66.130 at 2017-04-20 22:58:07 -0500
2017-04-20 22:58:07 beef70f9 [app] [I] Processing by
Api::V2::ReportsController#create as JSON
2017-04-20 22:58:07 beef70f9 [app] [I] Parameters: {"report"=>"[FILTERED]",
"apiv"=>"v2"}
2017-04-20 22:58:07 beef70f9 [app] [I] processing report for hostname.domain.com
2017-04-20 22:58:07 beef70f9 [app] [E] Unprocessable entity ConfigReport (id:
new):
| Report time has already been taken
|
2017-04-20 22:58:07 beef70f9 [app] [I] Rendered
api/v2/errors/unprocessable_entity.json.rabl within api/v2/layouts/error_layout
(1.4ms)
2017-04-20 22:58:07 beef70f9 [app] [I] Completed 422 Unprocessable Entity in
55ms (Views: 2.9ms | ActiveRecord: 5.9ms)
2017-04-20 22:58:07 3eddb29b [app] [I] Started POST "/api/v2/reports" for
10.121.66.130 at 2017-04-20 22:58:07 -0500
2017-04-20 22:58:07 3eddb29b [app] [I] Processing by
Api::V2::ReportsController#create as JSON
2017-04-20 22:58:07 3eddb29b [app] [I] Parameters: {"report"=>"[FILTERED]",
"apiv"=>"v2"}
2017-04-20 22:58:07 3eddb29b [app] [I] processing report for hostname.domain.com
2017-04-20 22:58:07 3eddb29b [app] [E] Unprocessable entity ConfigReport (id:
new):
| Report time has already been taken
|
2017-04-20 22:58:07 3eddb29b [app] [I] Rendered
api/v2/errors/unprocessable_entity.json.rabl within api/v2/layouts/error_layout
(0.7ms)
2017-04-20 22:58:07 3eddb29b [app] [I] Completed 422 Unprocessable Entity in
42ms (Views: 1.4ms | ActiveRecord: 4.7ms)