From charlesreid1

apt tasks

apt cache - but not every time

the apt cache is the local version of the package database. if this hasn't been updated in a while it will be out of sync with the latest version of the package database from the web.

apt-get update fixes this problem, but it can be time-consuming to run apt-get update every time you do anything with the playbook.

apt tasks now accept a cache_valid_time parameter for the apt module that specifies how many seconds old the cache should be to update it.

To make this setting 1 hour, set to 3600 s:

task:
 - name: update apt cache 
    apt: update_cache=yes cache_valid_time=3600

From: http://www.ansibleworks.com/docs/modules.html

Flags