# Flush fact cache from within playbook?

**URL:** <https://forum.ansible.com/t/flush-fact-cache-from-within-playbook/24816>\
**Category:** Ansible Project\
**Created:** [June 25, 2017, 7:22am UTC](https://forum.ansible.com/t/flush-fact-cache-from-within-playbook/24816 "2017-06-25T07:22:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [June 25, 2017, 7:22am UTC](https://forum.ansible.com/t/flush-fact-cache-from-within-playbook/24816/1 "2017-06-25T07:22:25Z")

</div>

Hi

I'm using fact caching which works great.  
For a specific task in one of my playbooks I don't want to use cached  
facts but "fresh" ones.  
I'm aware of the --flush-cache command line option, but the playbook  
in question can be included in others, so it's not always clear when  
running the main playbook if the cache should be flushed. To be safe I  
could just always use --flush-cache but that defeats the purpose of  
cached facts.

Is there a way to flush the cache from a playbook?  
Or any other suggestions for doing this (or maybe workarounds).

Thanks

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [June 26, 2017, 4:35pm UTC](https://forum.ansible.com/t/flush-fact-cache-from-within-playbook/24816/2 "2017-06-26T16:35:04Z")

</div>

[http://docs.ansible.com/ansible/meta\_module.html](http://docs.ansible.com/ansible/meta_module.html) has a 'clear\_facts' .

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [June 26, 2017, 8:59pm UTC](https://forum.ansible.com/t/flush-fact-cache-from-within-playbook/24816/3 "2017-06-26T20:59:13Z")

</div>

Spot on, thanks!!
