Problem:
When using the module ‘set_fact’ in ansible, the callback to The Foreman seems to be working, because Immediately after running the playbook, the facts are found in The Foreman.
But it seems that running a playbook with other facts set, erases the result from the previously set facts.
It seems also that with setting more than one fact, using the module, only the last one is reported.
In other words, we know about the issue, we’re trying to fix that but the PR in ansible repo is stale and we can’t get anyone to merge it. It will probably change soon, since the callback will live in some of our repos. Right now, you can patch the callback with the version from linked PR, that should fix the problem.
Could you give me a link to some resources how to patch the callback ?
It is a feature that would improve the use of Foreman a lot for us.
Thanks and keep up the fantastic work
Hi Thank you for the instructions.
Because the patched version of the callback was complaining about the requests module being to old, I decided to upgrade foreman itself. Accidently I upgraded to Foreman 2.1.0 instead of 1.24 ?
Now when I run ansible, the callback is working again, but even with this patched version, facts are still being erased from a previous run…
Can you please double check the patch is still applied? If you did something like yum upgrade, it may have updgraded also ansible package and hence remove the patch.
Yes, I copied it again after the update.
I did a diff with the copied version to double check
I’m now trying with gather_facts set to ‘yes’
It doesn’t seem to matter if I run consecutive playbooks or set multiple facts in one playbook
Also the callback file seems to be @ /usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.py whereas before there seem to be multiple locations
I’m sorry, I’m here again, but I really would like this feature to work.
I’m using a workaround putting all the info I need in a dictionary set this as my last fact.
Very rarely it occurs that one of the other facts that were set in this playbook ‘survives’ and appears next to the dictionary as a fact in Foreman.
Any tips on how I can troubleshoot this issue ?
Or should I try with a fresh install ?
It’s been a few months, but to get around the error: **[WARNING]: The requests python module is older than 2.14.0. Disabling the Foreman callback plugin.**
Replace the corresponding line that checks the requests version.
diff /tmp/foreman.py-new /usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.py
150c150
< if requests_version < (2, 14):
---
> if requests_version < (2):