Foreman - 1.20.1
Katello - 3.10
OS - CentOS 7.6.1810
I was able to get Katello to import the Ansible role. First I run /etc/ansible/hosts/foreman.py to update the files in hosts. Then when I try to run an ansible command from the cli I get:
[root@fm hosts]# ansible -m ping -i /etc/ansible/hosts/ tq3us1devtmqa08-host01.tm.XXXX.net
[WARNING]: Unable to parse /etc/ansible/hosts/foreman.cache as an inventory source[WARNING]: Unable to parse /etc/ansible/hosts/foreman.facts as an inventory source
[WARNING]: Unable to parse /etc/ansible/hosts/foreman.hostcollections as an inventory source
[WARNING]: Unable to parse /etc/ansible/hosts/foreman.index as an inventory source
[WARNING]: Unable to parse /etc/ansible/hosts/foreman.params as an inventory source
[WARNING]: Unable to parse /etc/ansible/hosts/foreman.py as an inventory source
[WARNING]: Skipping unexpected key (:password) in group (:foreman), only “vars”, “children” and “hosts” are valid
[WARNING]: Skipping unexpected key (:refresh_cache) in group (:foreman), only “vars”, “children” and “hosts” are valid
[WARNING]: Skipping unexpected key (:host) in group (:foreman), only “vars”, “children” and “hosts” are valid
[WARNING]: Skipping unexpected key (:request_timeout) in group (:foreman), only “vars”, “children” and “hosts” are valid
[WARNING]: Skipping unexpected key (:username) in group (:foreman), only “vars”, “children” and “hosts” are valid
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ‘all’
[WARNING]: Could not match supplied host pattern, ignoring: tq3us1devtmqa08-host01.tm.XXXX.net
[WARNING]: Skipping plugin (/etc/ansible/hosts/foreman.py) as it seems to be invalid: ‘module’ object has no attribute
‘CallbackModule’
Unless I am missing something it does not seem to be using the info in /etc/ansible/hosts.
I have my ansible.conf information in 2 files. /etc/ansible (containing modifications for foreman) and in /etc/ansible/roles (this config file worked with ansible on another host before the addition of foreman).
My configs are:
[root@fm ansible]# grep -v ‘^$|^\s*#’ ansible.cfg
[defaults]
inventory = /etc/ansible/hosts
roles_path = /etc/ansible/roles/tds_config/roles
callback_whitelist = foreman
callback_plugins = /etc/ansible/
inventory_plugins = /usr/share/ansible/plugins/inventory
bin_ansible_callbacks = True
[inventory]
enable_plugins = host_list, virtualbox, yaml, constructed
ignore_extensions = .pyc, .pyo, .swp, .bak, ~, .rpm, .md, .txt, ~, .orig, .ini, .cfg, .retry
[privilege_escalation]
[paramiko_connection]
[ssh_connection]
[persistent_connection]
[accelerate]
[selinux]
[colors]
[diff]
[callback_foreman]
url = ‘https://fm.tdsops.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
[root@fm ansible]# grep -v ‘^$|^\s*#’ foreman.ini
[foreman]
url = https://fm.XXXX.com/
user = admin
password =XXX
ssl_verify = True
[ansible]
group_patterns = [“{app}-{tier}-{color}”,
“{app}-{color}”,
“{app}”,
“{tier}”]
group_prefix = foreman_
want_facts = True
want_hostcollections = False
rich_params = False
want_ansible_ssh_host = False
[cache]
path = /etc/ansible/hosts
max_age = 60
scan_new_hosts = True
The foreman.py is in /etc/ansible/hosts