OS version CentOS Stream release 8
ansible 2.9.25
Foreman 2.5.3
After successfully installed foreman, ansible_plugin is not working.
/etc/ansible.ansible.cfg
callback_whitelist = foreman
bin_ansible_callbacks = True
Problem:
Expected outcome:
Foreman and Proxy versions:
Foreman and Proxy plugin versions:
Distribution and version:
Other relevant data:
evgeni
September 22, 2021, 6:35am
#2
You need to configure the callback, as otherwise it doesn’t know how to talk to Foreman.
The installer would have done this for you, or you can place something like the following into your ansible.cfg
[callback_foreman]
url = https://foreman.example.com
grep -v # /etc/foreman-proxy/ansible.cfg | grep -v ^$
[defaults]
callback_whitelist = theforeman.foreman.foreman
local_tmp = /tmp
host_key_checking = False
stdout_callback = yaml
roles_path = /etc/ansible/roles:/usr/share/ansible/roles
collections_paths = /etc/ansible/collections:/usr/share/ansible/collections
[callback_foreman]
url=https://foreman.example.com
ssl_cert = /etc/puppetlabs/puppet/ssl/certs/foreman.eng.example.com.pem
ssl_key = /etc/puppetlabs/puppet/ssl/private_keys/foreman.eng.example.com.pem
verify_certs = /etc/puppetlabs/puppet/ssl/certs/ca.pem
[ssh_connection]
ssh_args = -o ProxyCommand=none -C -o ControlMaster=auto -o ControlPersist=60s
grep -v # /etc/ansible/ansible.cfg | grep -v ^$
[defaults]
inventory = /etc/ansible/foreman.ini
callback_whitelist = foreman
callback_plugins = ~/.ansible/plugins/callback_plugins/
bin_ansible_callbacks = True
[inventory]
[privilege_escalation]
[paramiko_connection]
[ssh_connection]
[persistent_connection]
[accelerate]
[selinux]
[colors]
[diff]
Thank you for reply. I did configure [callback_foreman] and facing the same issue.
evgeni
September 23, 2021, 6:41am
#6
How are you calling Ansible? CLI? Foreman UI?
CLI, I haven’t try through Foreman UI.
ansible -m setup 10.10.198.174
evgeni
September 27, 2021, 2:37pm
#10
If you run it via CLI, /etc/foreman-proxy/ansible.cfg
isn’t read, and your /etc/ansible/ansible.cfg
doesn’t have any references to the Foreman callback config.
How would I make it work through CLI and if I want call playbook using foreman GUI keep it same config files will callback work? would you please guide me if I want to make it work using CLI? Thanks!
I have changed /etc/ansible.ansible.cfg to callback_forman. I am not getting error of url as mentioned above but the host has not been added to foreman UI.
evgeni
September 28, 2021, 7:09am
#13
You can set the path to the config using the ANSIBLE_CONFIG
environment variable.
But as you seem to got that part working now, I don’t know how the host creation in Foreman itself is supposed to work.
@Marek_Hulan @ezr-ondrej might know better
Please read this first - Foreman :: Updating Foreman inventory with system facts namely the ansible callback part.