update apt cache not too often

Hi folks,

Thanks for a great piece of tool that Ansible is, and long live!

I wonder (and cannot google easily) how to update apt cache at every playbook run, but not too often (say, once in 24 hours, or only if it was last updated more than 24 hours ago).

For a context: here is my playbook development workflow:

  1. I have vagrant box snapshotted at pristine state.
  2. I develop some playbook and run it against fresh box
  3. Debug issues, update playbook
  4. Run it against partially built box (to ensure idempotency etc)
  5. Fixed playbook, so reset the box to pristine state.
  6. goto 1.

So I want to have cache updated if it is old (p. 2), but I do not want to update it at every single run of playbook (p. 4) , be it incremental or even check run.

Thanks for reading,

Kudos,

The apt module has the cache_valid_time setting, which allows you to specify a minimum time between cache updates.

James,

Thanks!

How RTFM %)