Skip to content

Instantly share code, notes, and snippets.

@viq
Created October 29, 2013 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viq/7219585 to your computer and use it in GitHub Desktop.
Save viq/7219585 to your computer and use it in GitHub Desktop.
{% if grains['os'] == 'Debian' %}
{% set adm_group = sudo %}
{% else %}
{% set adm_group = wheel %}
{% endif %}
users:
mbarnett:
fullname: Melissa Barnett
groups:
- {{ adm_group }}
crypt: $6$eR6EbjW8$abCOo.v/bx629Sl0jz0R61jIE8kC8Q3v7VhxTDjTerSiJnF.9Qv2XXw/Whb3x48yBfFGAPmiHW5PAKxNcegcg1
home: /home/mbarnett
lward:
fullname: Lucas Ward
groups:
- {{ adm_group }}
crypt: $6$eR6EbjW8$abCOo.v/bx629Sl0jz0R61jIE8kC8Q3v7VhxTDjTerSiJnF.9Qv2XXw/Whb3x48yBfFGAPmiHW5PAKxNcegcg1
home: /home/lward
db1:
- Rendering SLS users failed, render error: Undefined jinja variable; line 372 in template
-
- {% 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 %}
-
- Traceback (most recent call last):
- File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1944, in render_state
- rendered_sls=mods
- File "/usr/lib/python2.7/dist-packages/salt/template.py", line 69, in compile_template
- ret = render(input_data, env, sls, **render_kwargs)
- File "/usr/lib/python2.7/dist-packages/salt/renderers/jinja.py", line 42, in render
- tmp_data.get('data', 'Unknown render error in jinja renderer')
- SaltRenderError: Undefined jinja variable; line 372 in template
-
- {% 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 %}
-
-
{% 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 %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment