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
| # Put this in /srv/salt/_modules/myutils.py | |
| # Call from Jinja with {{ salt['myutils.check_vals']() }} | |
| def check_vals(): | |
| if __pillar__['val'] != __pillar__['val2']: | |
| raise Exception("Invalid data!") |
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
| {% if grains['hostname'] == 'myHost' %} | |
| param1 = value1 | |
| {% elif grains['hostname'] == 'myOtherHost' %} | |
| param1 = value2 | |
| {% else %} | |
| param1 = value3 | |
| {% endif %} | |
| You could also do: |
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
| vts: | |
| file.managed: | |
| - name: /etc/apache2/sites-available/vts.cfg | |
| - source: salt://webserver/vts.cfg | |
| a2ensite_vts.cfg: | |
| cmd.run: | |
| - onlyif: test ! -L /etc/apache2/sites-enabled/vts.cfg | |
| - watch: | |
| - file: vts |
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
| echo foo > /tmp/foo: | |
| cmd.run: | |
| - onlyif: test -e {{ pillar['some_file'] }} |
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
| snmpd: | |
| pkg: | |
| - installed | |
| service: | |
| - running | |
| - name: snmpd | |
| - require: | |
| - pkg: snmpd | |
| snmpd.conf: |
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
| apache/files.sls #Here we manage our other files: | |
| apache_conf: | |
| file.managed: | |
| - name: {{ pillar['pkgs_settings']['apache_sites_available'] }}/graphite | |
| - source: salt://graphite_server/files/apache/graphite | |
| - template: jinja | |
| apache_link: | |
| file.symlink: |
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
| apache/init.sls #This is simply our init which starts the service, and sets up this one managed file for the service (this could be broken out further): | |
| apache_service: | |
| service: | |
| - name: {{ pillar['pkgs']['apache'] }} | |
| - enable: True | |
| - running | |
| --------------------------------------------- | |
| apache/files.sls #Here we manage our other files: |
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
| libmemcached-remove: | |
| pkg.removed: | |
| - name: libmemcached-dev | |
| - version: '<1.0.16-1' |
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
| ---------------- | |
| livedb_crons.sls | |
| ---------------- | |
| /cron.livedb: | |
| file.directory: | |
| - user: root | |
| - group: root | |
| - mode: 644 | |
| - makedirs: True |
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
| {% for ab, ba in pillar['groups'].iteritems() %} | |
| {% for i in ba %} | |
| {{ i }}: | |
| group: | |
| - present | |
| {% endfor %} | |
| {% endfor %} |