ansiblepackage-managers

How to update package cache when using module package from ansible


If I run apt, I can update the package cache:

apt:
  name: postgresql
  state: present
  update_cache: yes

I'm now trying to use the generic package command, but I don't see a way to do this.

package:
  name: postgresql
  state: present

Do I have to run an explicit command to run apt-get update, or can I do this using the package module?


Solution

  • This is not possible.

    The module package as of writing is just capable to handle package presence, so you have to use directly the package module to refresh the cache.