Skip to content

Instantly share code, notes, and snippets.

@viq
Created October 31, 2013 16:46
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/7252972 to your computer and use it in GitHub Desktop.
Save viq/7252972 to your computer and use it in GitHub Desktop.
How can I include this state to have {{groupname}} replaced by desired value?
{% 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'] }}
{% 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