This repository has been archived on 2023-06-27. You can view files and clone it, but cannot push or open issues or pull requests.
salt-states_old/common/users.sls

39 lines
1005 B
Plaintext
Raw Permalink Normal View History

2020-12-22 10:46:20 +00:00
{% 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 %}