# Forcing a gather when using caching

**URL:** <https://forum.ansible.com/t/forcing-a-gather-when-using-caching/26522>\
**Category:** Ansible Project\
**Created:** [January 20, 2018, 2:09pm UTC](https://forum.ansible.com/t/forcing-a-gather-when-using-caching/26522 "2018-01-20T14:09:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeffrey\_Honig](https://avatars.discourse-cdn.com/v4/letter/j/7993a0/32.png) [@Jeffrey\_Honig](https://forum.ansible.com/u/Jeffrey_Honig)\
**Post date:** [January 20, 2018, 2:09pm UTC](https://forum.ansible.com/t/forcing-a-gather-when-using-caching/26522/1 "2018-01-20T14:09:56Z")

</div>

I’m using:

> > jch@jch-air[727]:master$ ansible --version
> 
> > ansible 2.4.2.0
> 
> > config file = /Users/jch/Documents/ttn-multitech-cm/master/ansible.cfg
> 
> > configured module search path = [u’/Users/jch/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]
> 
> > ansible python module location = /usr/local/Cellar/ansible/2.4.2.0\_2/libexec/lib/python2.7/site-packages/ansible
> 
> > executable location = /usr/local/bin/ansible
> 
> > python version = 2.7.10 (default, Jul 15 2017, 17:16:57) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]

I’m caching facts:  
`

gathering = smart  
fact\_caching = jsonfile  
fact\_caching\_connection = catalog  
fact\_caching\_timeout = 3600

`

My targets are low powered embedded gateways running Yocto Project Linux, so I implement some speed-up with facts. One of the facts is a list of packages installed, this greatly speeds up an Ansible run as I do not need to run individual opkg tasks if the package is in the package list fact.

However, I am running into a caching issue. If I install or remove a package, I need to update the facts. I can do this at the end of a run in a handler. However the caching seems to ignore my attempt to refresh the cache with:

`

- name: Reload ansible\_local  
setup: filter=ansible\_local  
`

It seems to me that this is a bug. The documentation is not too clear on the interaction between setup\_module and caching. Or am I missing a way to force a reload?

Thanks.

Jeff

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [January 20, 2018, 2:59pm UTC](https://forum.ansible.com/t/forcing-a-gather-when-using-caching/26522/2 "2018-01-20T14:59:09Z")

</div>

Do a clear facts first, it also clear the cache  
&nbsp;&nbsp;- meta: clear\_facts
