Last active
August 29, 2015 14:04
-
-
Save ryan-lane/e3f3bd08b75942107e52 to your computer and use it in GitHub Desktop.
Load pillar files in the top file based on the grain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
base: | |
# For each directory that can have pillar files | |
{% for root in opts['pillar_roots']['base'] -%} | |
# Set a variable to the path to check | |
{% set mygrain_sls = '{0}/{1}.sls'.format(root, grains['mygrain']) -%} | |
# Check to see if the file exists, if so, include that pillar file. | |
{% if salt['file.file_exists'](mygrain_sls) %} | |
'service_group:{{ grains["mygrain"] }}': | |
- match: grain | |
- {{ grains['mygrain'] }} | |
{% endif %} | |
{% endfor -%} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment