Problem:
Ansible callback don’t work properly
Expected outcome:
Callback from hosts
Foreman and Proxy versions:
Foreman 1.18.1
Foreman and Proxy plugin versions:
bastion 6.1.10
foreman-tasks 0.13.4
foreman_ansible 2.2.5
foreman_docker 4.1.0
foreman_remote_execution 1.5.5
katello 3.7.0
Other relevant data:
RHEL 7.5
ansible 2.6.3 or 2.6.2
Info about our foreman:
Fully working box with >100vm/hypervisor, only one have puppet working (the foreman host) to send facts.
Hi all,
we’re trying to use ansible as callback to foreman and we followed the guide 2.x for ansible >2.5:
https://theforeman.org/plugins/foreman_ansible/2.x/index.html
Our callback is installed with Ansible itself, change /etc/ansible/ansible.cfg
to contain
[defaults]
callback_whitelist = foreman
and the callback will be enabled after that.
Of course, the callback cannot know automatically where is Foreman located and which certificates to use in its requests.
To configure it, add a section [callback_foreman]
at the end of /etc/ansible/ansible.cfg
like this:
[callback_foreman]
url = 'https://foreman.example.com'
ssl_cert = /etc/foreman-proxy/ssl_cert.pem
ssl_key = /etc/foreman-proxy/ssl_key.pem
verify_certs = /etc/foreman-proxy/ssl_ca.pem
On foreman server and on an external host we changed the ansible.cfg as requested.
We installed and enabled on foreman the plugin:
tfm-rubygem-foreman_ansible.noarch 2.2.5-1.fm1_18.el7 @foreman-plugins
tfm-rubygem-foreman_ansible_core.noarch
tfm-rubygem-hammer_cli_foreman_ansible.noarch
tfm-rubygem-hammer_cli_foreman_ansible-doc.noarch
After that we needed to configure the plugin:
If you want to use Ansible and submit facts/reports to Foreman, through the callback, you should add whatever hosts (again, except Smart Proxies) you want to submit facts from to the setting trusted_puppetmaster_hosts
. Change it at Administer > Settings, Auth tab. e.g: If you’re running Ansible from host ‘A’, which SSHs into host ‘B’, you need to add host ‘A’
Well, go to Administer -> Settings -> Authentication and search for trusted_puppetmaster_hosts. No match, only one match with trusted_hosts name.
Do we have to insert all our hosts into this array?
Next item is the usage. We tried to lunch the ansible setup as:
ansible -m setup localhost
on several VMs and all the fact appeared but nothing is present on log/web GUI.
Is it the correct way?
According to first point we don’t have to install the callback, just to configure ansible on each host to be able to send facts to foreman server.
And last but not least…no roles appear into Roles section, is it correct?
Thanks a lot