0
votes

I have an example playbook below. When I say cacheable: true where are facts stored? Also, how to delete these facts after for a fresh play? I have looked into the remote host(our example database) and found nothing and on the local host(where I ran my playbook) too cannot find it. I can see the facts displayed though. Found this on ansible docs https://docs.ansible.com/ansible/2.5/modules/set_fact_module.html not much helpful to understand though.

 ---
 - name: Setting database facts 
   hosts: database_servers:!localhost
   tasks:
   - name: set_facts for database servers
       set_fact:
         database_endpoints:   "{{ remote_endpoints_dev }}"
         cacheable: true
       when: ENVIR == "dev"
1

1 Answers

1
votes

When I say cacheable: true where are facts stored?

cacheable only takes effect if fact caching is enabled, and where the facts get stored depends on how you configured fact caching.

Also, how to delete these facts after for a fresh play?

The facts will get updated every time the set_fact task runs. I use tags to control when those tasks run. You can control how long things stay in cache in the fact caching configuration.