Ansible callback saying requests not installed

Problem:
The Foreman callback plug-in is saying that requests is not installed therefore no systems are getting updated/registered via Ansible.

Expected outcome:
Foreman callback plug-in to update hosts information via Ansible.

Foreman and Proxy versions:
Foreman 3.1.2

Foreman and Proxy plugin versions:
Ansible 3

Distribution and version:
Centos 8 stream

Other relevant information:
python3-requests RPM is installed from upstream, removing that and substituting with python3 -m pip installed requests did not change the outcome.

Try installing python38-requests please, if you’re running with ansible-core 2.12 from CentOS 8 Stream

That worked I also had to point to the puppet certificates for the callback to work a 100%

[defaults]
callback_whitelist = foreman

[callback_foreman]
url = 'https://foreman.example.com'
ssl_cert = /etc/puppetlabs/puppet/ssl/certs/foreman.example.com.pem
ssl_key = /etc/puppetlabs/puppet/ssl/private_keys/foreman.example.com.pem
verify_certs = /etc/puppetlabs/puppet/ssl/certs/ca.pem

How did the config look before that? The installer should setup all certs correctly.

I’ve proposed changes that should pull in the right requests to packaging in adjust dependencies to pull in right requests and pyyaml by evgeni · Pull Request #7714 · theforeman/foreman-packaging · GitHub

It had nothing other then the comments, I added the defaults and callback section manuly

# Since Ansible 2.12 (core):
# To generate an example config file (a "disabled" one with all default settings, commented out):
#               $ ansible-config init --disabled > ansible.cfg
#
# Also you can now have a more complete file by including existing plugins:
# ansible-config init --disabled -t all > ansible.cfg

# For previous versions of Ansible you can check for examples in the 'stable' branches of each version
# Note that this file was always incomplete  and lagging changes to configuration settings

# for example, for 2.9: https://github.com/ansible/ansible/blob/stable-2.9/examples/ansible.cfg

Wait, is this /etc/ansible/ansible.cfg as used by Ansible itself or /etc/foreman-proxy/ansible.cfg as used by the Foreman integration? :wink:

Ahh I see, I was a bit confused based on the documentation Ansiblecallback it made it seem that /etc/ansible/ansible.cfg was still the main file that the configs needed to be in.

It “depends”.

On the one hand, I think the docs are a tad outdated (cc @Marek_Hulan, @ezr-ondrej).

On the other there are two major ways of using the callback:

  • via the Foreman Ansible integration, which is setup automatically for you if you’re using the installer and uses /etc/foreman-proxy/ansible.cfg
  • manually from essentially any system that can run Ansible (and thus reads /etc/ansible/ansible.cfg)

In most cases, users want the former. The later is relevant if you have a separate environment to run Ansible from (AWX, Rundeck, whatever) and still want the reports be available in Foreman.

Makes sense