Search code examples
salt-project

How to execute pkg.refresh_db in a salt state?


I have the following sls file:

python:
  pkg.installed:
    - pkgs:
      - python2_x64

How can I edit this file to make sure pkg.refresh_db is executed prior to attepting to install Python?

I can manually run the refresh like this: salt -G 'os:windows' pkg.refresh_db


Solution

  • pkg:
    module.run:
      - name: pkg.refresh_db
    
    python:
    pkg.installed:
      - pkgs:
        - python2_x64