Foreman Ansible Callback

Problem: Some hosts report an Ansible Callback Issue

Expected outcome: The Callback works

Foreman and Proxy versions: 1.18

Foreman and Proxy plugin versions:

Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]
Ansible version: 2.6

I see in vvv mode that the Facts are reported but can not be updatet in foreman, but other Hosts will report their Facts

<somehost> ESTABLISH SSH CONNECTION FOR USER: ansible
<somehost> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ansible/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/b84141cc5e somehost '/bin/sh -c '"'"'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1533814186.35-199017792279671/ > /dev/null 2>&1 && sleep 0'"'"''
<somehost> (0, '', '')
 [WARNING]: Failure using method (v2_runner_on_ok) in callback plugin (<ansible.plugins.callback.minimal.CallbackModule object at 0x7f1039cefe90>): 'module' object has no attribute 'dumps'

Callback Exception:
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py", line 374, in send_callback
    method(*new_args, **kwargs)
   File "/usr/lib/python2.7/site-packages/ansible/plugins/callback/minimal.py", line 64, in v2_runner_on_ok
    self._display.display("%s | SUCCESS => %s" % (result._host.get_name(), self._dump_results(result._result, indent=4)), color=C.COLOR_OK)
   File "/usr/lib/python2.7/site-packages/ansible/plugins/callback/__init__.py", line 123, in _dump_results
    return json.dumps(abridged_result, cls=AnsibleJSONEncoder, indent=indent, ensure_ascii=False, sort_keys=sort_keys)

 [WARNING]: Failure using method (v2_runner_on_ok) in callback plugin (<ansible.plugins.callback./usr/share/ansible/plugins/callback/foreman_callback.CallbackModule object at 0x7f1039e52a90>): 'module_name'

Callback Exception:
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py", line 374, in send_callback
    method(*new_args, **kwargs)
   File "/usr/share/ansible/plugins/callback/foreman_callback.py", line 245, in v2_runner_on_ok
    self.send_facts(host, res)
   File "/usr/share/ansible/plugins/callback/foreman_callback.py", line 101, in send_facts
    if re.search(r'^junos', data['invocation']['module_name']):

META: ran handlers
META: ran handlers
 [WARNING]: Failure using method (v2_playbook_on_stats) in callback plugin (<ansible.plugins.callback./usr/share/ansible/plugins/callback/foreman_callback.CallbackModule object at 0x7f1039e52a90>): 'module' object has no attribute 'dumps'

Callback Exception:
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py", line 374, in send_callback
    method(*new_args, **kwargs)
   File "/usr/lib/python2.7/site-packages/ansible/plugins/callback/__init__.py", line 400, in v2_playbook_on_stats
    self.playbook_on_stats(stats)
   File "/usr/share/ansible/plugins/callback/foreman_callback.py", line 234, in playbook_on_stats
    self.send_reports(stats)
   File "/usr/share/ansible/plugins/callback/foreman_callback.py", line 161, in send_reports
    metrics=json.dumps(metrics),

Playbook run took 0 days, 0 hours, 0 minutes, 1 seconds

Thanks for the logs, could you share what happens in /var/log/foreman/production.log when you run Ansible and submit facts? Also which version of the plugin are you in?

Plugin Version:

[root@foreman01 ~]# yum info tfm-rubygem-foreman_ansible
Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
Installed Packages
Name        : tfm-rubygem-foreman_ansible
Arch        : noarch
Version     : 2.2.5
Release     : 1.fm1_18.el7
Size        : 18 M
Repo        : installed
From repo   : foreman-plugins
Summary     : Ansible integration with Foreman (theforeman.org)
URL         : https://github.com/theforeman/foreman_ansible
License     : GPLv3
Description : Ansible integration with Foreman.

LOG:

2018-08-09T16:08:47 [I|app|] Started POST "/api/v2/hosts/facts" for 10.16.1.153 at 2018-08-09 16:08:47 +0200
2018-08-09T16:08:47 [I|app|df7ad] Processing by Api::V2::HostsController#facts as JSON
2018-08-09T16:08:47 [I|app|df7ad]   Parameters: {"facts"=>"[FILTERED]", "name"=>"dockerregistry", "apiv"=>"v2", "host"=>{"name"=>"dockerregistry"}}
2018-08-09T16:08:47 [I|app|df7ad] Current user: foreman_api_admin (administrator)
2018-08-09T16:08:48 [I|app|df7ad] Import facts for 'dockerregistry' completed. Added: 1, Updated: 13, Deleted 0 facts
2018-08-09T16:08:48 [I|app|df7ad] Completed 201 Created in 822ms (Views: 2.5ms | ActiveRecord: 174.5ms)

Thank you, that 201 indicates the host facts for “dockerregistry” were imported just fine, what exactly is failing then? Config Reports are not showing up?

Foreman shows that the last execution is failed

yeah it solved