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
| {% from "users/map.jinja" import users with context %} | |
| group1: | |
| mbarnett: | |
| fullname: Melissa Barnett | |
| home: /home/mbarnett |
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
| {% from "users/map.jinja" import users with context %} | |
| group1: | |
| mbarnett: | |
| fullname: Melissa Barnett | |
| groups: | |
| - {{ users.adm_group }} | |
| crypt: $6$eR6EbjW8$abCOo.v/bx629Sl0jz0R61jIE8kC8Q3v7VhxTDjTerSiJnF.9Qv2XXw/Whb3x48yBfFGAPmiHW5PAKxNcegcg1 | |
| home: /home/mbarnett |
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 user, args in pillar[{{groupname}}].iteritems() %} | |
| {{ user }}: | |
| # group: | |
| # - present | |
| user.present: | |
| - home: {{ args['home'] }} | |
| {% if 'password' in args %} | |
| - password: {{ args['password'] }} | |
| {% if 'enforce_password' in args %} | |
| - enforce_password: {{ args['enforce_password'] }} |
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['nodename'] == 'db1' %} | |
| include: | |
| - users.group3: | |
| key: users | |
| # - users.group1: | |
| # key: users1 | |
| {% 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
| ``` | |
| 2013-10-30 17:46:49,198 [salt.master ][ERROR ] Error in function _pillar: | |
| Traceback (most recent call last): | |
| File "/usr/lib/python2.7/dist-packages/salt/master.py", line 1494, in run_func | |
| ret = getattr(self, func)(load) | |
| File "/usr/lib/python2.7/dist-packages/salt/master.py", line 1107, in _pillar | |
| data = pillar.compile_pillar() | |
| File "/usr/lib/python2.7/dist-packages/salt/pillar/__init__.py", line 451, in compile_pillar | |
| pillar, errors = self.render_pillar(matches) | |
| File "/usr/lib/python2.7/dist-packages/salt/pillar/__init__.py", line 368, in render_pillar |
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['os'] == 'Debian' %} | |
| {% set adm_group = sudo %} | |
| {% else %} | |
| {% set adm_group = wheel %} | |
| {% endif %} | |
| users: | |
| mbarnett: | |
| fullname: Melissa Barnett |
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
| root@saltmaster:~# salt 'db1' state.show_sls users.group1 | |
| db1: | |
| ---------- | |
| root@saltmaster:~# |
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
| base: | |
| 'os:OpenBSD': | |
| - match: grain | |
| - carp | |
| - test | |
| 'db1 or app1': | |
| - match: compound | |
| - wordpress | |
| 'db1': | |
| - users.admin |
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['os'] == 'Debian' %} | |
| adm_group: sudo | |
| {% else %} | |
| adm_group: wheel | |
| {% 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
| append-file: | |
| cmd: | |
| - cwd: /tmp | |
| - names: | |
| {% for user, name in pillar['names'].iteritems() %} | |
| - echo {{ user }} {{ name.['number'] }} >> logfile.txt | |
| {% endfor %} | |
| - run |