Bug #23413
closedForeman 1.16.1 & Ansible 2.5 callback error
Description
New to Foreman, I am trying to integrate Ansible with Foreman 1.16.1
Using 2 different server 1. Foreman 2. Ansible
Ansible Server
Followed the steps: https://www.theforeman.org/plugins/foreman_ansible/0.x/index.html
1. etc/ansible/ansible.cfg Updated (callback_plugins = ~/.ansible/plugins/callback_plugins/
bin_ansible_callbacks = True)
2. New File: ~/.ansible/plugins/callback_plugins/foreman_callback.py
Foreman Server:
1. Update /etc/environment & /etc/sysconfig/foreman file with URL update
FOREMAN_URL=https://<foreman url>
FOREMAN_SSL_CERT=/etc/foreman/client_cert.pem
FOREMAN_SSL_KEY=/etc/foreman/client_key.pem
FOREMAN_SSL_VERIFY=0
I am using Centos7.4
While running playbook in ansible I am getting this error:
[WARNING]: Failure using method (v2_playbook_on_stats) in callback plugin (<ansible.plugins.callback.foreman_calback.CallbackModule object
at 0xd199d0>): 'module' object has no attribute 'dumps'
Callback Exception:
File "/usr/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py", line 375, in send_callback
method(*new_args, **kwargs)
File "/usr/lib/python2.7/site-packages/ansible/plugins/callback/__init__.py", line 389, in v2_playbook_on_stats
self.playbook_on_stats(stats)
File "/root/.ansible/plugins/callback_plugins/foreman_calback.py", line 234, in playbook_on_stats
self.send_reports(stats)
File "/root/.ansible/plugins/callback_plugins/foreman_calback.py", line 155, in send_reports
log = self._build_log(self.items[host])
File "/root/.ansible/plugins/callback_plugins/foreman_calback.py", line 132, in _build_log
'messages': {'message': json.dumps(msg)},
If I am following these instructions: https://github.com/theforeman/theforeman.org/blob/gh-pages/plugins/foreman_ansible/2.x/index.md
As ansible is 2.5
/etc/ansible/ansible.cfg only changes (bin_ansible_callbacks = True
callback_whitelist = foreman)
with this file ~/.ansible/plugins/callback_plugins/foreman.py
I am not getting any error but there is not Host update in Foreman
Updated by Marek Hulán over 6 years ago
- Project changed from Foreman to Ansible
- Category deleted (
foreman-debug)
I'm not sure if it's the same backtrace but Ansible 2.5 callback (facts part) is know to be broken, fix is already merged in master and should be available in Ansible 2.5.2, please let us know once it's available if it fixes your issue.
Updated by prem prakash over 6 years ago
Hi Marek,
Do you think with Ansible 2.5 & Foreman 1.16.1 this callback will work
Updating ansible.cfg:
/etc/ansible/ansible.cfg only changes (bin_ansible_callbacks = True
callback_whitelist = foreman)
Foreman.py file (https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/callback/foreman.py)
with this file ~/.ansible/plugins/callback_plugins/foreman.py
Updated /etc/environment & /etc/sysconfig/foreman file with url, but not sure if these environment variable are set?
Even with this approach I am not getting any host update in foreman after running successful playbook.
Updated by prem prakash over 6 years ago
Tried with Ansible 2.5.2 with Foreman 1.16.1 + Katello 3.5
Still same error
[WARNING]: Failure using method (v2_playbook_on_stats) in callback plugin
(<ansible.plugins.callback.foreman_calback.CallbackModule object at 0x227e5d0>): 'module' object has no attribute
'dumps'
Updated by Ondřej Ezr almost 4 years ago
- Status changed from New to Rejected
Sorry for closing this, but now the callback is comming from foreman-ansible-modules collection and is completely rewritten, so this issue is no longer relevant.