Hello,
I’m trying to set up foreman to use ansible but I am stuck.
I followed this documentation: https://www.theforeman.org/plugins/foreman_ansible/2.x/index.html
I did a fresh installation on debian buster with foreman-installer:
root@ansible-foreman:/tmp# foreman-installer
–enable-foreman-plugin-ansible --enable-foreman-proxy-plugin-ansible
–enable-foreman-plugin-remote-execution --enable-foreman-proxy-plugin-remote-execution-ssh
–enable-foreman-cli --enable-foreman-cli-ansible
Then I set up the callback in ansible:
[defaults]
callback_whitelist = foreman
local_tmp = /tmp
host_key_checking = False
stdout_callback = yaml
roles_path = /etc/ansible/roles:/usr/share/ansible/roles
inventory = /etc/ansible/hosts[callback_foreman]
url = https://ansible-foreman
ssl_cert = /etc/puppetlabs/puppet/ssl/certs/ansible-foreman.neos.nsoc-obiane.com.pem
ssl_key = /etc/puppetlabs/puppet/ssl/private_keys/ansible-foreman.neos.nsoc-obiane.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[inventory]
enable_plugins = foreman
First problem here: callback kind of works since the host is created in foreman, but only three facts show up (hostname, nodename, fqdn). Where are all the other facts ?
Then I tried to launch ansible from foreman, using a scheduled job.
I did something simple :
- Ansible command
- Run command - SSH default
- touch /tmp/test
Jobs fails, so does every job I try to make in foreman which is using ansible.
I see this error is foreman-proxy log:
2020-12-21T14:09:31 79449323 [W] Error processing request '79449323-bf01-4a12-93a5-311d67f17a24: : uninitialized constant ForemanAnsibleCore
Did you mean? ForemanTasksCore
Did I do something wrong ? Or did I run into some kind of bug ?
Could someone help me in making ansible calls work from Foreman ?
Thank you
Versions info:
- Debian buster
- Foreman 2.2.1
- Proxy features Dynflow, Ansible, SSH, PuppetCA, Puppet and Logs
- Foreman-tasks 3.0.1
- Foreman_ansible 6.0.0
- Foreman_remote_execution 4.1.0
- Ansible 2.9.15