Problem:
Running a playbook from within TFM with "gather_facts: False wipes out all the facts for a host that are stored in TFM. I guess that it’s the callback that does this.
When running an Ansible playbook from within TFM gathering facts takes a long time. That’s nothing new in Ansible and is one of the reasons we have caching via Redis or JSON files etc.
I had initially tried enabling fact caching from within /etc/foreman-proxy/ansible.cfg but it seems those settings are ignored, presumably because TFM runs the playbook via ansible-runner and for some reason ansible-runner does not make use of the cache, it ignores settings like:
fact_caching = redis
fact_caching_connection = localhost:6379:0
Maybe this is the wrong way to be thinking about this?
All of those facts are already “cached” in TFM itself, why not just use those. Maybe run a playbook once per day that updates all the facts for my hosts and then all the other times I run playbooks and roles from within TFM set gather_facts = False.
The “why not” is because of course “gather_facts = False” will cause the ansible callback to wipe out all the facts stored in TFM.
The following in a playbook will produce nothing because the ansible call back wipes out all my facts first.
debug:
var: ansible_facts[‘os_family’]
Expected outcome:
When running a playbook/role from within TFM, a playbook with “gather_facts = False”, all the previously existing Ansible facts don’t get deleted.
Or, some advice on how I should try to solve the problem of fact gathering causing playbooks run from within TFM to take a long time which should not be the case, I should be able to “not gather facts”, I already have the facts in TFM.
Foreman and Proxy versions:
Foreman 1.24.2
foreman_ansible 4.0.4
Distribution and version:
CentOS 7