Created
October 29, 2013 12:41
-
-
Save viq/7213934 to your computer and use it in GitHub Desktop.
users.sls is state, rest are pillars. I can't get it to use the 'adm_group' 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' %} | |
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
include: | |
- users.admin | |
users: | |
mbarnett: | |
fullname: Melissa Barnett | |
groups: | |
- {{ salt['pillar.get']('adm_group') }} | |
crypt: $6$eR6EbjW8$abCOo.v/bx629Sl0jz0R61jIE8kC8Q3v7VhxTDjTerSiJnF.9Qv2XXw/Whb3x48yBfFGAPmiHW5PAKxNcegcg1 | |
home: /home/mbarnett | |
pub_ssh_keys: | |
- ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBJaCbwZbztcLoExqmQ0ss2O7aMZbH/Ab35aglmSJJJzygD9VM3j3NIxHoZp9Cd5z5xn9CtDNRrifTNBqoPXi8NHL+DYPH4O+RiUSDaBcQ2eWJ9VMMGGuWnKpHNYcJZ3tOA== Melissa Barnett | |
lward: | |
fullname: Lucas Ward | |
groups: | |
- {{ salt['pillar.get']('adm_group') }} | |
crypt: $6$eR6EbjW8$abCOo.v/bx629Sl0jz0R61jIE8kC8Q3v7VhxTDjTerSiJnF.9Qv2XXw/Whb3x48yBfFGAPmiHW5PAKxNcegcg1 | |
home: /home/lward | |
pub_ssh_keys: | |
- ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBAxxGtP94N1TV91W4DAk933JFcJcsg0Kr4gzzyi9aVddMpqsoxEQ3ORH43SeZeFsCATYdeln6ktaPnTpFFzLDyrST3eXKQ/ryZ22+pE7u+0UpAhTc/3OLD0PKpRagNRIsw== Lucas Ward | |
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.group1 | |
# - users.group3 | |
{% 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
{% for user, args in pillar['users'].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'] }} | |
{% endif %} | |
{% endif %} | |
- fullname: {{ args['fullname'] }} | |
{% if 'groups' in args %} | |
- groups: {{ args['groups'] }} | |
{% endif %} | |
- require: | |
- group: {{ user }} | |
{% if 'key.pub' in args and args['key.pub'] == True %} | |
{{ user }}_key.pub: | |
ssh_auth: | |
- present | |
- user: {{ user }} | |
- source: salt://users/{{ user }}/keys/key.pub | |
{% endif %} | |
{% endfor %} |
# salt db1 pillar.get adm_group
db1:
sudo
state.show_highstate
shows:
lward:
----------
__env__:
base
__sls__:
users
group:
- present
----------
- order:
10006
user:
----------
- home:
/home/lward
----------
- fullname:
Lucas Ward
----------
- groups:
None
----------
- require:
----------
- group:
lward
- present
----------
- order:
10007
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gives: