**Problem: If I use “Run Ansible Roles” from a host, the ansible callback is called in the playbook and reports are updated but If I run a remote execution job with Job category * Ansible playbook and Job template defined by me (which is collecting facts) the playbook shows no ansible callback being used and thus no reports are updated
*Expected outcome: For every ansible playbook run which by default is gathering facts the ansible callback should be called and reports should be updated for the host.
I have enabled the ansible callback in the /etc/ansible/ansible.cfg file.
**Foreman and Proxy versions:**1.19.0
Foreman and Proxy plugin versions:
foreman_remote_execution 1.5.6 Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]
(for logs, surround with three back-ticks to get proper formatting, e.g.)
Im using /etc/ansible/ansible.cfg ( the problem is that when I run the default ansible role via Run Ansible Roles button or via Schedule Remote Job -> Ansible Playbook -> Ansible Roles -> Ansible default) the callback works without any issues for any other playbook it doesnt.
I`ve even tried to make a ansible.cfg in /etc/foreman-proxy/ansible.cfg but nothing.
I`ve also noticed that /etc/ansible/ansible.cfg is read for every ansilbe run triggered from the proxy.
I have everything configured, the problem is that sometimes they work sometimes they dont depending on the ansible playbook that I use. Still I dont know where the issue is as I`m using gather facts for all my playbooks.
Note that we don’t import configuration report for every ansible run triggered from Foreman. Just those that “play roles” assigned to host/hostgroup. For arbitrary runs, the “report” is only archived in job output. We thought storing a report under non regular/non converging ansible run and hence changing host configuration status on based on things like “install package” or “restart httpd”, would be too confusing.
I had a similar problem just now, several ansible callback (30% of my servers) hanged without a reason and all the following “recurring logic” job (every 30 minutes) were unable to complete the run. I checked into Monitor -> Jobs and Tasks and a lot job/task were in waiting and several ansible processes into the server were in hang state
To solve the issue I ran:
Checked that there are no important jobs or steps running.
Cleaned the postgres db of foreman for all running jobs/task
su - postgres
delete from foreman_tasks_tasks where id in(select id from foreman_tasks_tasks where state = ‘stopped’ and result = ‘error’);
delete from foreman_tasks_tasks where id in(select id from foreman_tasks_tasks where state = ‘stopped’ and result = ‘warning’);
delete from foreman_tasks_tasks where id in(select id from foreman_tasks_tasks where state = ‘paused’ and result = ‘error’);
delete from foreman_tasks_tasks where id in(select id from foreman_tasks_tasks where state = ‘running’ and result = ‘warning’);
delete from foreman_tasks_tasks where id in(select id from foreman_tasks_tasks where state = ‘running’ and result = ‘pending’);
Ran a task cleanup
All hanged task/jobs disappear (obviously) and the next “callback call” will work properly.