-
-
Save anonymous/adde3ff46ce9052c56b5 to your computer and use it in GitHub Desktop.
This file contains 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'].items() %} | |
{% if args['disabled'] is not defined %} | |
group_{{ user }}: | |
group.present: | |
- name: {{ user }} | |
{% if args['uid'] is defined -%} | |
- gid: {{ args['uid'] }} | |
{% endif %} | |
user_{{ user }}: | |
user.present: | |
- name: {{ user }} | |
{% if args['uid'] is defined -%} | |
- uid: {{ args['uid'] }} | |
{% endif -%} | |
- gid_from_name: True | |
{% if args['password'] is defined -%} | |
- password: {{ args['password'] }} | |
{% endif %} | |
{% if args['groups'] is defined -%} | |
- groups: | |
{% for group in args['groups'] -%} | |
- {{ group }} | |
{% endfor %} | |
{% endif %} | |
{% if args['key'] is defined %} | |
ssh_key_{{ user }}: | |
ssh_auth.present: | |
- name: {{ args['key'] }} | |
- user: {{ user }} | |
{% endif %} | |
{% else %} | |
user_{{ user }}: | |
user.absent: | |
- name: {{ user }} | |
{% if args['disabled']|lower() == 'purge' -%} | |
- purge: True | |
{% endif %} | |
group_{{ user }}: | |
group.absent: | |
- name: {{ user }} | |
{% endif %} | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment