Project

General

Profile

Actions

Bug #19661

closed

facts are not being imported into foreman from ansible playbook run (host & reports work OK)

Added by David LeVene about 7 years ago. Updated over 3 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Upon setting up ansible module as per https://theforeman.org/plugins/foreman_ansible/1.x/index.html, reports and host creation is working as expected but host facts are not being imported.

They are being seen in the reports - I have asked my question here but no response https://groups.google.com/forum/#!topic/foreman-users/A1M2TRXtfkw

Fresh installation on CentOS 7
ansible-2.3.0.0-3.el7.noarch
foreman-1.15.0-1.el7.noarch

foreman-installer -i \
--enable-foreman-plugin-ansible \
--foreman-foreman-url=http://foreman.levene.local/

Updated /usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.py
FOREMAN_URL = os.getenv('FOREMAN_URL', "https://foreman.levene.local:443")
FOREMAN_SSL_CERT = (os.getenv('FOREMAN_SSL_CERT',
"/etc/puppetlabs/puppet/ssl/certs/foreman.levene.local.pem"),
os.getenv('FOREMAN_SSL_KEY',
"/etc/puppetlabs/puppet/ssl/private_keys/foreman.levene.local.pem"))
FOREMAN_SSL_VERIFY = os.getenv('FOREMAN_SSL_VERIFY', "/etc/puppetlabs/puppet/ssl/certs/ca.pem")

Set the values
[root@foreman ~]# grep -i foreman /etc/ansible/ansible.cfg
callback_whitelist = foreman
#callback_whitelist = foreman

Ansible run from within foreman interfaces shows

017-05-24 18:31:54 efd6329d [app] [I] Redirected to https://foreman.levene.local/foreman_tasks/tasks/a37a3a0b-1493-4d06-ad3f-aa6495587283
2017-05-24 18:31:54 efd6329d [app] [I] Completed 302 Found in 425ms (ActiveRecord: 27.6ms)
2017-05-24 18:31:54 57f35b8d [app] [I] Started GET "/foreman_tasks/tasks/a37a3a0b-1493-4d06-ad3f-aa6495587283" for 192.168.137.1 at 2017-05-24 18:31:54 +0930
2017-05-24 18:31:54 57f35b8d [app] [I] Processing by ForemanTasks::TasksController#show as HTML
2017-05-24 18:31:54 57f35b8d [app] [I] Parameters: {"id"=>"a37a3a0b-1493-4d06-ad3f-aa6495587283"}
2017-05-24 18:31:54 57f35b8d [app] [I] Current user: dlevene (administrator)
2017-05-24 18:31:54 57f35b8d [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.1/app/views/foreman_tasks/tasks/_details.html.erb (96.2ms)
2017-05-24 18:31:54 57f35b8d [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.1/app/views/foreman_tasks/tasks/_running_steps.html.erb (1.9ms)
2017-05-24 18:31:54 57f35b8d [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.1/app/views/foreman_tasks/tasks/_errors.html.erb (1.1ms)
2017-05-24 18:31:54 57f35b8d [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.1/app/views/foreman_tasks/tasks/_raw.html.erb (21.7ms)
2017-05-24 18:31:54 57f35b8d [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.1/app/views/foreman_tasks/tasks/_locks.html.erb (10.1ms)
2017-05-24 18:31:54 57f35b8d [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.1/app/views/foreman_tasks/tasks/show.html.erb within layouts/application (152.0ms)
2017-05-24 18:31:54 57f35b8d [app] [I] Rendered layouts/_application_content.html.erb (0.3ms)
2017-05-24 18:31:54 57f35b8d [app] [I] Rendered home/_user_dropdown.html.erb (28.7ms)
2017-05-24 18:31:54 57f35b8d [app] [I] Read fragment views/tabs_and_title_records-3 (0.1ms)
2017-05-24 18:31:54 57f35b8d [app] [I] Rendered home/_topbar.html.erb (34.7ms)
2017-05-24 18:31:54 57f35b8d [app] [I] Rendered layouts/base.html.erb (36.2ms)
2017-05-24 18:31:54 57f35b8d [app] [I] Completed 200 OK in 236ms (Views: 180.7ms | ActiveRecord: 41.3ms)
2017-05-24 18:31:54 641a6140 [app] [I] Started GET "/assets/foreman_tasks/tasks-066b4f761bd333e7764a63f8846215f9c4bbff64e4b466c34b6b4163533444c3.css" for 192.168.137.1 at 2017-05-24 18:31:54 +0930

2017-05-24 18:31:55 ceb92df5 [app] [I] Started GET "/notification_recipients" for 192.168.137.1 at 2017-05-24 18:31:55 +0930
2017-05-24 18:31:55 ceb92df5 [app] [I] Processing by NotificationRecipientsController#index as JSON
2017-05-24 18:31:55 ceb92df5 [app] [I] Current user: dlevene (administrator)
2017-05-24 18:31:55 ceb92df5 [app] [I] Completed 200 OK in 5ms (Views: 0.2ms | ActiveRecord: 0.6ms)
2017-05-24 18:31:58 24943a4c [app] [I] Started POST "/api/v2/reports" for 192.168.137.41 at 2017-05-24 18:31:58 +0930
2017-05-24 18:31:58 24943a4c [app] [I] Processing by Api::V2::ReportsController#create as JSON
2017-05-24 18:31:58 24943a4c [app] [I] Parameters: {"report"=>"[FILTERED]", "apiv"=>"v2"}
2017-05-24 18:31:58 24943a4c [app] [I] Current user: foreman_api_admin (administrator)
2017-05-24 18:31:58 24943a4c [app] [I] processing report for foreman.levene.local
2017-05-24 18:31:58 24943a4c [app] [I] Imported report for foreman.levene.local in 0.06 seconds
2017-05-24 18:31:58 24943a4c [app] [I] Rendered api/v2/reports/create.json.rabl (18.9ms)
2017-05-24 18:31:58 24943a4c [app] [I] Completed 201 Created in 119ms (Views: 26.1ms | ActiveRecord: 24.9ms)
2017-05-24 18:31:59 463755ef [app] [I] Started GET "/foreman_tasks/tasks/a37a3a0b-1493-4d06-ad3f-aa6495587283" for 192.168.137.1 at 2017-05-24 18:31:59 +0930
2017-05-24 18:32:00 463755ef [app] [I] Processing by ForemanTasks::TasksController#show as HTML
2017-05-24 18:32:00 463755ef [app] [I] Parameters: {"id"=>"a37a3a0b-1493-4d06-ad3f-aa6495587283"}
2017-05-24 18:32:00 463755ef [app] [I] Current user: dlevene (administrator)
2017-05-24 18:32:00 33e24e82 [app] [I] Started POST "/foreman_tasks/api/tasks/callback" for 192.168.137.41 at 2017-05-24 18:32:00 +0930
2017-05-24 18:32:00 33e24e82 [app] [I] Processing by ForemanTasks::Api::TasksController#callback as XML
2017-05-24 18:32:00 33e24e82 [app] [I] Parameters: {"callback"=>{"task_id"=>"a37a3a0b-1493-4d06-ad3f-aa6495587283", "step_id"=>3}, "data"=>{"result"=>[{"output_type"=>"stdout", "output"=>"\r\nPLAY [all] *************************************************************\r\n\r\nTASK [Gathering Facts] *************************************************\r\n", "timestamp"=>1495616515.6741207}, {"output_type"=>"stdout", "output"=>"ok: [foreman.levene.local]\r\n\r\nTASK [common : be sure ntp is installed] *******************************\r\nok: [foreman.levene.local]\r\n\r\nTASK [common : be sure ntpd is running and enabled] ********************\r\n", "timestamp"=>1495616517.782848}, {"output_type"=>"stdout", "output"=>"ok: [foreman.levene.local]\r\n\r\nPLAY RECAP *************************************************************\r\nforeman.levene.local : ok=3 changed=0 unreachable=0 failed=0 \r\n\r\n", "timestamp"=>1495616518.7837021}], "runner_id"=>"c5b4e1e2-3af6-4295-8b11-08e81bf71be6", "exit_status"=>0}, "task"=>{}}
2017-05-24 18:32:00 33e24e82 [app] [I] Current user: foreman_api_admin (administrator)
2017-05-24 18:32:00 33e24e82 [app] [I] Completed 200 OK in 8ms (Views: 0.2ms | ActiveRecord: 0.9ms)
2017-05-24 18:32:01 463755ef [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.1/app/views/foreman_tasks/tasks/_details.html.erb (532.6ms)
2017-05-24 18:32:01 463755ef [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.1/app/views/foreman_tasks/tasks/_running_steps.html.erb (9.9ms)
2017-05-24 18:32:01 463755ef [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.1/app/views/foreman_tasks/tasks/_errors.html.erb (2.0ms)
2017-05-24 18:32:01 463755ef [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.1/app/views/foreman_tasks/tasks/_raw.html.erb (10.0ms)
2017-05-24 18:32:01 463755ef [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.1/app/views/foreman_tasks/tasks/_locks.html.erb (14.8ms)
2017-05-24 18:32:01 463755ef [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.1/app/views/foreman_tasks/tasks/show.html.erb within layouts/application (590.8ms)
2017-05-24 18:32:01 463755ef [app] [I] Rendered layouts/_application_content.html.erb (1.9ms)
2017-05-24 18:32:01 463755ef [app] [I] Rendered home/_user_dropdown.html.erb (15.4ms)
2017-05-24 18:32:01 463755ef [app] [I] Read fragment views/tabs_and_title_records-3 (0.1ms)
2017-05-24 18:32:01 463755ef [app] [I] Rendered home/_topbar.html.erb (31.6ms)
2017-05-24 18:32:01 463755ef [app] [I] Rendered layouts/base.html.erb (38.2ms)
2017-05-24 18:32:01 463755ef [app] [I] Completed 200 OK in 792ms (Views: 642.7ms | ActiveRecord: 14.9ms)
2017-05-24 18:32:01 2532c952 [app] [I] Started GET "/assets/foreman_tasks/tasks-066b4f761bd333e7764a63f8846215f9c4bbff64e4b466c34b6b4163533444c3.css" for 192.168.137.1 at 2017-05-24 18:32:01 +0930
2017-05-24 18:32:01 b2af38c7 [app] [I] Started GET "/notification_recipients" for 192.168.137.1 at 2017-05-24 18:32:01 +0930
2017-05-24 18:32:01 b2af38c7 [app] [I] Processing by NotificationRecipientsController#index as JSON
2017-05-24 18:32:01 b2af38c7 [app] [I] Current user: dlevene (administrator)
2017-05-24 18:32:01 b2af38c7 [app] [I] Completed 200 OK in 8ms (Views: 0.4ms | ActiveRecord: 0.7ms)
2017-05-24 18:32:06 4ceb3f5c [app] [I] Started GET "/foreman_tasks/tasks/a37a3a0b-1493-4d06-ad3f-aa6495587283" for 192.168.137.1 at 2017-05-24 18:32:06 +0930
2017-05-24 18:32:06 4ceb3f5c [app] [I] Processing by ForemanTasks::TasksController#show as HTML
2017-05-24 18:32:06 4ceb3f5c [app] [I] Parameters: {"id"=>"a37a3a0b-1493-4d06-ad3f-aa6495587283"}
2017-05-24 18:32:06 4ceb3f5c [app] [I] Current user: dlevene (administrator)


Files

Capture.JPG View Capture.JPG 37.2 KB Wilmar den Ouden, 08/17/2017 02:17 PM
Actions

Also available in: Atom PDF