Problem:
I installed ansible smart proxy foreman plugin:
I would like to use it along with ansible foreman callback plugin in order to report facts from the hosts to Foreman. I am not sure how this plugin is supposed to work. Was trying to figure it out, but unfortunately, documentation to say the least is not very extensive and informative:
https://docs.ansible.com/ansible/latest/collections/theforeman/foreman/foreman_callback.html#ansible-collections-theforeman-foreman-foreman-callback
Likewise, the documentation of the ansible plugin is outdated:
https://theforeman.org/plugins/foreman_ansible/2.x/index.html
To help me out I checked the source code of the callback plugin to figure out the parameters I need to use, how they work etc.
So my ansible configuration file is:
[defaults]
callbacks_enabled=foreman
[callback_foreman]
proxy_url = https://myserver.net:8443
url = https://myserver.net
report_type=proxy
client_cert=/etc/puppetlabs/puppet/ssl/certs/myserver.net.pem
client_key=/etc/puppetlabs/puppet/ssl/private_keys/myserver.net.pem
verify_certs=/etc/puppetlabs/puppet/ssl/certs/ca.pem
I have NOT generated these certs by myself, they are certs generated by puppet while installing foreman. The same certs are used in the foreman-proxy settings.yml file. It doesn’t matter in this context though, as I don’t have any ssl-related errors.
My simple ansible playbook:
---
- name: Test
hosts: external_hosts
gather_facts: no
tasks:
- name: setup
ansible.builtin.setup:
Executing ansible with above settings:
ansible-playbook -i myinventory.ini ans1-only-setup.yaml
PLAY [Test] *******************************************************************************************************************************************************************
TASK [debug inventory hostname] ***********************************************************************************************************************************************
[WARNING]: Platform linux on host 10.76.4.34 is using the discovered Python interpreter at /usr/bin/python2.7, but future installation of another Python interpreter could
change the meaning of that path. See Interpreter Discovery — Ansible Core Documentation for more information.
ok: [10.76.4.34]PLAY RECAP ********************************************************************************************************************************************************************
10.76.4.34 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0[WARNING]: Sending data to Foreman at https://myserver.net failed for 10.76.4.34: 404 Client Error: Not Found for url:
https://myserver.net:8443/reports/ansible
404?! Why it happens? Am I missing something? How it supposed to work? How can I gather facts from the hosts through smart proxy?
Expected outcome:
Ansible Foreman Callback plugin successfully reports facts to foreman through smart proxy.
Foreman and Proxy versions:
Foreman 3.13
Foreman Ansible collection 5.1.0
Distribution and version:
Alma Linux 9.4