first commit
This commit is contained in:
38
common/users.sls
Normal file
38
common/users.sls
Normal file
@@ -0,0 +1,38 @@
|
||||
{% for user, args in pillar['users'].items() %}
|
||||
# remove users
|
||||
{% if args['remove'] is defined %}
|
||||
{{ user }}:
|
||||
user.absent
|
||||
{% if 'alias_target' in args %}
|
||||
alias.present:
|
||||
- target: {{ args['alias_target'] }}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
# add users
|
||||
{{ user }}:
|
||||
user.present:
|
||||
- fullname: {{ args['fullname'] | default('') }}
|
||||
- home: {{ args['home'] | default('/home/'+user) }}
|
||||
- shell: {{ args['shell'] | default('/bin/bash') }}
|
||||
{% if args['uid'] is defined %}
|
||||
- uid: {{ args['uid'] }}
|
||||
{% endif %}
|
||||
- password: {{ args['password'] }}
|
||||
- enforce_password: {{ args['enforce_password'] | default('True') }}
|
||||
{% if 'groups' in args %}
|
||||
- groups: {{ args['groups'] }}
|
||||
{% endif %}
|
||||
{% if 'alias_target' in args %}
|
||||
alias.present:
|
||||
- target: {{ args['alias_target'] }}
|
||||
{% endif %}
|
||||
|
||||
{% if 'ssh_auth' in args %}
|
||||
{{ user }}_autherized_keys:
|
||||
ssh_auth:
|
||||
- present
|
||||
- user: {{ user }}
|
||||
- names: {{ args['ssh_auth'] }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
Reference in New Issue
Block a user