Skip to content

Instantly share code, notes, and snippets.

@rterbush
Created November 11, 2015 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rterbush/379eae8548d12384bdc4 to your computer and use it in GitHub Desktop.
Save rterbush/379eae8548d12384bdc4 to your computer and use it in GitHub Desktop.
reactor
{% if grains['os'] == 'Windows' %}
refresh_pkg_db:
local.saltutil.pkg.refresh_db:
- tgt: {{ data['id'] }}
{% endif %}
@Ch3LL
Copy link

Ch3LL commented Nov 11, 2015

I am currently using this in my setup to only run if a grain is not present. I believe you can use the same logic without the not included:

new_minion:
  cmd.state.highstate:
    - tgt: {{ "{0} and not G@initialize:True".format(data['id']) }}
    - expr_form: compound

This might work for your scenario:

refresh_pkg_db:
  local.saltutil.pkg.refresh_db:
    - tgt: {{ "{0} and G@os:Windows".format(data['id']) }}
    - expr_form: compound

@rterbush
Copy link
Author

master config:

reactor:
  - 'minion_start':
    - /srv/salt/reactor/sync_grains.sls
    - /srv/salt/reactor/sync_pillar.sls
    - /srv/salt/reactor/windows_pkg.sls
    - /srv/salt/reactor/elb_registration.sls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment