Hello everybody,
My problem is i can’t run ansible roles via Foreman WebUI, you can show error in screenshot
Ansible callback works.
Ansible version : 2.4.2.0
Foreman version : 1.18.0.0 (i have same problem with 1.16. version)
Katello version : 3.7 (i have same problem with 3.5 version)
The problem surely come from me but i have not yet found the solution.
This command works :
1st command:
bash-4.2$ whoami
foreman
bash-4.2$ sudo ansible-playbook test.yml
PLAY [foreman.mydomain.lab] ******************************************************************************
TASK [Gathering Facts] *****************************************************************************************
ok: [foreman.mydomain.lab]
TASK [Create file] *********************************************************************************
changed: [foreman.mydomain.lab]
PLAY RECAP **********************************************************************************
foreman.mydomain.lab : ok=2 changed=1 unreachable=0 failed=0
2nd command:
bash-4.2$ whoami
foreman-proxy
bash-4.2$ sudo ansible-playbook test.yml
PLAY [foreman.mydomain.lab] ***************************************************************************************
TASK [Gathering Facts] **************************************************************************************
ok: [foreman.mydomain.lab]
TASK [Create file] *******************************************************************************************
changed: [foreman.mydomain.lab]
PLAY RECAP ******************************************************************************************
foreman.mydomain.lab : ok=2 changed=1 unreachable=0 failed=0
Logs :
2018-02-15T16:44:56 6e4072a9 [app] [I] Started GET "/ansible/hosts/6/play_roles" for 172.23.10.4 at 2018-02-15 16:44:56 +0100
2018-02-15T16:44:56 6e4072a9 [app] [I] Processing by HostsController#play_roles as HTML
2018-02-15T16:44:56 6e4072a9 [app] [I] Parameters: {"id"=>"6"}
2018-02-15T16:44:56 6e4072a9 [app] [I] Current user: admin (administrator)
2018-02-15T16:44:56 6e4072a9 [app] [D] Setting current user thread-local variable to admin
2018-02-15T16:44:56 6e4072a9 [app] [D] Setting current location thread-local variable to none
2018-02-15T16:44:56 6e4072a9 [app] [D] Setting current organization thread-local variable to none
2018-02-15T16:44:57 6e4072a9 [dynflow] [D] ExecutionPlan 7fe9991d-c609-4e64-882e-97df12c58152 pending >> planning
2018-02-15T16:44:57 6e4072a9 [dynflow] [D] Step 7fe9991d-c609-4e64-882e-97df12c58152: 1 pending >> running in phase Plan Actions::RemoteExecution::RunHostsJob
2018-02-15T16:44:57 6e4072a9 [app] [I] Current user: admin (administrator)
2018-02-15T16:44:57 6e4072a9 [app] [D] Setting current user thread-local variable to admin
2018-02-15T16:44:57 6e4072a9 [app] [I] Current user: admin (administrator)
2018-02-15T16:44:57 6e4072a9 [app] [D] Setting current user thread-local variable to admin
2018-02-15T16:44:57 6e4072a9 [dynflow] [D] Step 7fe9991d-c609-4e64-882e-97df12c58152: 1 running >> success in phase Plan Actions::RemoteExecution::RunHostsJob
2018-02-15T16:44:57 6e4072a9 [dynflow] [D] ExecutionPlan 7fe9991d-c609-4e64-882e-97df12c58152 planning >> planned
2018-02-15T16:44:57 6e4072a9 [app] [I] Redirected to htps://foreman.mydomain.lab/job_invocations/37
2018-02-15T16:44:57 6e4072a9 [app] [I] Completed 302 Found in 1067ms (ActiveRecord: 155.2ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Started GET "/job_invocations/37" for 172.23.10.4 at 2018-02-15 16:44:57 +0100
2018-02-15T16:44:57 1d8d4696 [app] [I] Processing by JobInvocationsController#show as HTML
2018-02-15T16:44:57 1d8d4696 [app] [I] Parameters: {"id"=>"37"}
2018-02-15T16:44:57 1d8d4696 [app] [I] Current user: admin (administrator)
2018-02-15T16:44:57 1d8d4696 [app] [D] Setting current user thread-local variable to admin
2018-02-15T16:44:57 1d8d4696 [app] [D] Setting current location thread-local variable to none
2018-02-15T16:44:57 1d8d4696 [app] [D] Setting current organization thread-local variable to none
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendering /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/show.html.erb within layouts/application
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/_tab_overview.html.erb (91.1ms)
2018-02-15T16:44:57 1d8d4696 [app] [D] Unpermitted parameter: :id
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/_host_name_td.html.erb (1.2ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/_host_status_td.html.erb (1.0ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/_host_actions_td.html.erb (2.5ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered common/_pagination.html.erb (2.4ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/_tab_hosts.html.erb (17.7ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/show.html.erb within layouts/application (191.8ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered layouts/_application_content.html.erb (1.1ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendering layouts/base.html.erb
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered home/_organization_dropdown.html.erb (30.2ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered home/_location_dropdown.html.erb (16.5ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered home/_org_switcher.html.erb (49.8ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered home/_user_dropdown.html.erb (2.5ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered home/_topbar.html.erb (56.2ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered home/_vertical_menu.html.erb (6.3ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered home/_vertical_menu.html.erb (11.7ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered home/_vertical_menu.html.erb (1.6ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered home/_vertical_menu.html.erb (5.7ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered home/_vertical_menu.html.erb (4.6ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered home/_vertical_menu.html.erb (3.4ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered home/_vertical_menu.html.erb (4.8ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered home/_vertical_taxonomies.html.erb (3.6ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered home/_vertical_taxonomies.html.erb (2.6ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered home/_vertical_menu.html.erb (0.9ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered home/_navbar.html.erb (59.2ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Rendered layouts/base.html.erb (121.9ms)
2018-02-15T16:44:57 1d8d4696 [app] [I] Completed 200 OK in 356ms (Views: 297.7ms | ActiveRecord: 26.1ms)
2018-02-15T16:44:58 c6fa63df [app] [I] Started GET "/notification_recipients" for 172.23.10.4 at 2018-02-15 16:44:58 +0100
2018-02-15T16:44:58 c6fa63df [app] [I] Processing by NotificationRecipientsController#index as JSON
2018-02-15T16:44:58 c6fa63df [app] [I] Current user: admin (administrator)
2018-02-15T16:44:58 c6fa63df [app] [D] Setting current user thread-local variable to admin
2018-02-15T16:44:58 c6fa63df [app] [D] Setting current location thread-local variable to none
2018-02-15T16:44:58 c6fa63df [app] [D] Setting current organization thread-local variable to none
2018-02-15T16:44:58 c6fa63df [notifications] [D] Cache Hit: notification, reading cache for notification-4
2018-02-15T16:44:58 c6fa63df [app] [D] Body: {"notifications":[{"id":14,"seen":false,"level":"warning","text":"foreman.mydomain.lab has no owner set","created_at":"2018-02-15T14:26:48.127Z","group":"Hosts","actions":{"links":[{"href":"/hosts/foreman.mydomain.lab/edit","title":"Update host"}]}},{"id":13,"seen":false,"level":"info","text":"foreman.mydomain.lab has been deleted successfully","created_at":"2018-02-15T14:22:25.515Z","group":"Hosts","actions":{}},{"id":12,"seen":false,"level":"info","text":"Foreman Community Newsletter - December 2017","created_at":"2018-02-15T02:33:12.199Z","group":"Community","actions":{"links":[{"href":"htp://theforeman.org/2017/12/foreman-community-newsletter-december-2017.html","title":"Open","external":true}]}},{"id":8,"seen":false,"level":"info","text":"Security of Foreman’s templating endpoint","created_at":"2018-02-15T02:33:12.169Z","group":"Community","actions":{"links":[{"href":"htp://theforeman.org/2018/01/templating-security.html","title":"Open","external":true}]}},{"id":4,"seen":false,"level":"info","text":"Foreman Community Newsletter - January 2018","created_at":"2018-02-15T02:33:12.063Z","group":"Community","actions":{"links":[{"href":"htp://theforeman.org/2018/01/foreman-community-newsletter-january-2018.html","title":"Open","external":true}]}}]}
2018-02-15T16:44:58 c6fa63df [app] [I] Completed 200 OK in 6ms (Views: 0.1ms | ActiveRecord: 0.4ms)
2018-02-15T16:44:59 eaa7dc27 [app] [I] Started GET "/job_invocations/37?hosts_needs_refresh=&host_ids_needing_name_update%5B%5D=6&host_ids_needing_status_update%5B%5D=6&_=1518709497980" for 172.23.10.4 at 2018-02-15 16:44:59 +0100
2018-02-15T16:44:59 eaa7dc27 [app] [I] Processing by JobInvocationsController#show as JS
2018-02-15T16:44:59 eaa7dc27 [app] [I] Parameters: {"hosts_needs_refresh"=>"", "host_ids_needing_name_update"=>["6"], "host_ids_needing_status_update"=>["6"], "_"=>"1518709497980", "id"=>"37"}
2018-02-15T16:44:59 eaa7dc27 [app] [I] Current user: admin (administrator)
2018-02-15T16:44:59 eaa7dc27 [app] [D] Setting current user thread-local variable to admin
2018-02-15T16:44:59 eaa7dc27 [app] [D] Setting current location thread-local variable to none
2018-02-15T16:44:59 eaa7dc27 [app] [D] Setting current organization thread-local variable to none
2018-02-15T16:44:59 eaa7dc27 [app] [I] Rendering /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/show.js.erb
2018-02-15T16:44:59 eaa7dc27 [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/_host_name_td.html.erb (1.4ms)
2018-02-15T16:44:59 eaa7dc27 [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/_host_status_td.html.erb (1.2ms)
2018-02-15T16:44:59 eaa7dc27 [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/show.js.erb (52.7ms)
2018-02-15T16:44:59 eaa7dc27 [app] [I] Completed 200 OK in 89ms (Views: 55.9ms | ActiveRecord: 5.6ms)
2018-02-15T16:45:00 50a97bc8 [app] [I] Started GET "/job_invocations/37?hosts_needs_refresh=&host_ids_needing_status_update%5B%5D=6&_=1518709497981" for 172.23.10.4 at 2018-02-15 16:45:00 +0100
2018-02-15T16:45:00 50a97bc8 [app] [I] Processing by JobInvocationsController#show as JS
2018-02-15T16:45:00 50a97bc8 [app] [I] Parameters: {"hosts_needs_refresh"=>"", "host_ids_needing_status_update"=>["6"], "_"=>"1518709497981", "id"=>"37"}
2018-02-15T16:45:00 50a97bc8 [app] [I] Current user: admin (administrator)
2018-02-15T16:45:00 50a97bc8 [app] [D] Setting current user thread-local variable to admin
2018-02-15T16:45:00 50a97bc8 [app] [D] Setting current location thread-local variable to none
2018-02-15T16:45:00 50a97bc8 [app] [D] Setting current organization thread-local variable to none
2018-02-15T16:45:00 50a97bc8 [app] [I] Rendering /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/show.js.erb
2018-02-15T16:45:00 50a97bc8 [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/_host_status_td.html.erb (0.9ms)
2018-02-15T16:45:00 50a97bc8 [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.4.5/app/views/job_invocations/show.js.erb (37.6ms)
2018-02-15T16:45:00 50a97bc8 [app] [I] Completed 200 OK in 70ms (Views: 34.8ms | ActiveRecord: 8.2ms)
2018-02-15T16:45:01 77752f0c [app] [I] Started POST "/foreman_tasks/api/tasks/callback" for 172.25.0.13 at 2018-02-15 16:45:01 +0100
2018-02-15T16:45:01 77752f0c [app] [I] Processing by ForemanTasks::Api::TasksController#callback as */*
2018-02-15T16:45:01 77752f0c [app] [I] Parameters: {"callback"=>{"task_id"=>"940cad10-dbd5-4d11-9e54-c9b770826f9e", "step_id"=>3}, "data"=>{"result"=>[{"output_type"=>"stdout", "output"=>"\r\nPLAY [foreman.mydomain.lab] ******************************************************\r\n\r\nTASK [Gathering Facts] *********************************************************\r\nfatal: [foreman.mydomain.lab]: UNREACHABLE! => {\"changed\": false, \"msg\": \"Failed to connect to the host via ssh: write: Broken pipe\\r\\n\", \"unreachable\": true}\r\n\tto retry, use: --limit @/tmp/foreman-playbook-53b04182-fa9a-419a-85aa-360b79260b02.retry\r\n\r\nPLAY RECAP *********************************************************************\r\nforeman.mydomain.lab : ok=0 changed=0 unreachable=1 failed=0 \r\n\r\n [WARNING]: Failure using method (v2_playbook_on_stats) in callback plugin\r\n(<ansible.plugins.callback.foreman.CallbackModule object at 0x17e3190>):\r\n('Connection aborted.', error(111, 'Connection refused'))\r\n", "timestamp"=>1518709500.5428278}], "runner_id"=>"08bc38c6-9627-4f23-aa60-4e0318686330", "exit_status"=>4}, "task"=>{}}
2018-02-15T16:45:01 77752f0c [app] [D] Examining client certificate to extract dn and sans
2018-02-15T16:45:01 77752f0c [app] [D] Client sent certificate with subject 'foreman.mydomain.lab' and subject alt names '["foreman.mydomain.lab"]'
2018-02-15T16:45:01 77752f0c [app] [D] Verifying request from ["foreman.mydomain.lab"] against ["foreman.mydomain.lab", "foreman.mydomain.lab"]
2018-02-15T16:45:01 77752f0c [app] [I] Current user: foreman_api_admin (administrator)
2018-02-15T16:45:01 77752f0c [app] [D] Setting current user thread-local variable to foreman_api_admin
2018-02-15T16:45:01 77752f0c [app] [D] Body: {"message":"processing"}
2018-02-15T16:45:01 77752f0c [app] [I] Completed 200 OK in 67ms (Views: 0.3ms | ActiveRecord: 17.9ms)