Last active
December 18, 2015 11:48
-
-
Save godber/5777861 to your computer and use it in GitHub Desktop.
A Salt SLS Module for managing a per host /etc/salt/minion.d/grains.conf file based on matching host IDs. If there is a host.conf file, that will be used, if not, then default.conf will be used.
This file contains hidden or 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
salt-minion: | |
pkg: | |
- installed | |
service: | |
- running | |
- require: | |
- pkg: salt-minion | |
- watch: | |
- file: /etc/salt/minion.d/grains.conf | |
/etc/salt/minion.d/grains.conf: | |
file: | |
- managed | |
{% if salt['cp.hash_file']('salt://minion/' + grains['id'] + '.conf') %} | |
- source: {{'salt://minion/' + grains['id'] + '.conf'}} | |
{% else %} | |
- source: salt://minion/default.conf | |
{% endif %} |
This file contains hidden or 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
salt-minion: | |
pkg: | |
- installed | |
service: | |
- running | |
- require: | |
- pkg: salt-minion | |
- watch: | |
- file: /etc/salt/minion.d/grains.conf | |
/etc/salt/minion.d/grains.conf: | |
file: | |
- managed | |
- source: | |
- salt://minion/{{ + grains['id'] + }}.conf | |
- salt://minion/default.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As it turns out, there is no reason to do what is shown in gistfile1.yml.
sources
can be given a list and will use the first one it finds. gistfile2.yml provides a better example.I discovered this here:
http://docs.saltstack.com/ref/states/all/salt.states.file.html#operations-on-files-directories-and-symlinks