# fact\_caching override in playbook?

**URL:** <https://forum.ansible.com/t/fact-caching-override-in-playbook/33740>\
**Category:** Ansible Project\
**Created:** [September 3, 2020, 9:40pm UTC](https://forum.ansible.com/t/fact-caching-override-in-playbook/33740 "2020-09-03T21:40:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aprameya\_NDS](https://avatars.discourse-cdn.com/v4/letter/a/4bbf92/32.png) [@Aprameya\_NDS](https://forum.ansible.com/u/Aprameya_NDS)\
**Post date:** [September 3, 2020, 9:40pm UTC](https://forum.ansible.com/t/fact-caching-override-in-playbook/33740/1 "2020-09-03T21:40:27Z")

</div>

Hi Team,

I have a project which uses ansible to run traffic tools on a given set of hosts.  
I have fact\_caching enabled.

While configuring and starting the traffic there are at times where the facts in the system changes dynamically for which i need to freshly gather facts but due to fact\_caching mechanism i get the cached output.

Can we override fact\_caching in the playbook dynamically based on requirements?

Regards  
Sai

---

<div class="post-metadata">

**Author:** ![Kuldip\_Madnani1](https://avatars.discourse-cdn.com/v4/letter/k/91b2a8/32.png) [@Kuldip\_Madnani1](https://forum.ansible.com/u/Kuldip_Madnani1)\
**Post date:** [September 3, 2020, 11:08pm UTC](https://forum.ansible.com/t/fact-caching-override-in-playbook/33740/2 "2020-09-03T23:08:15Z")

</div>

You can run this as a pre step to clear the cache:  
rm ${fact\_caching\_connection}/\*

where fact\_caching\_connection can be configured in your ansible.cfg

---

<div class="post-metadata">

**Author:** ![Nuno\_Jordao](https://avatars.discourse-cdn.com/v4/letter/n/a4c791/32.png) [@Nuno\_Jordao](https://forum.ansible.com/u/Nuno_Jordao)\
**Post date:** [September 5, 2020, 4:10am UTC](https://forum.ansible.com/t/fact-caching-override-in-playbook/33740/3 "2020-09-05T04:10:08Z")

</div>

Maybe the clear\_facts meta module and a new fact gathering may work in your case?

[https://docs.ansible.com/ansible/latest/modules/meta\_module.html](https://docs.ansible.com/ansible/latest/modules/meta_module.html)
