Forcing a gather when using caching

18 views
Skip to first unread message

Jeffrey Honig

unread,
Jan 20, 2018, 9:09:56 AM1/20/18
to Ansible Project
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

Kai Stian Olstad

unread,
Jan 20, 2018, 9:59:28 AM1/20/18
to ansible...@googlegroups.com
On Saturday, 20 January 2018 15.09.56 CET Jeffrey Honig wrote:
> 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?

Do a clear facts first, it also clear the cache
- meta: clear_facts

--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages