|
|
|
|
|
|
|
|
{%- endif -%} |
|
|
{%- endif -%} |
|
|
{%- set current = salt.user.info(name) -%} |
|
|
{%- set current = salt.user.info(name) -%} |
|
|
{%- set home = user.get('home', current.get('home', "/home/%s" % name)) -%} |
|
|
{%- set home = user.get('home', current.get('home', "/home/%s" % name)) -%} |
|
|
|
|
|
{%- set createhome = user.get('createhome') -%} |
|
|
|
|
|
|
|
|
{%- if 'prime_group' in user and 'name' in user['prime_group'] %} |
|
|
{%- if 'prime_group' in user and 'name' in user['prime_group'] %} |
|
|
{%- set user_group = user.prime_group.name -%} |
|
|
{%- set user_group = user.prime_group.name -%} |
|
|
|
|
|
|
|
|
{% endfor %} |
|
|
{% endfor %} |
|
|
|
|
|
|
|
|
{# in case home subfolder doesn't exist, create it before the user exists #} |
|
|
{# in case home subfolder doesn't exist, create it before the user exists #} |
|
|
{% if user.get('createhome', True) %} |
|
|
|
|
|
|
|
|
{% if createhome -%} |
|
|
users_{{ name }}_user_prereq: |
|
|
users_{{ name }}_user_prereq: |
|
|
file.directory: |
|
|
file.directory: |
|
|
- name: {{ salt['file.dirname'](home) }} |
|
|
- name: {{ salt['file.dirname'](home) }} |
|
|
|
|
|
|
|
|
{%- endif %} |
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
users_{{ name }}_user: |
|
|
users_{{ name }}_user: |
|
|
{% if user.get('createhome', True) %} |
|
|
|
|
|
|
|
|
{% if createhome -%} |
|
|
file.directory: |
|
|
file.directory: |
|
|
- name: {{ home }} |
|
|
- name: {{ home }} |
|
|
- user: {{ user.get('homedir_owner', name) }} |
|
|
- user: {{ user.get('homedir_owner', name) }} |
|
|
|
|
|
|
|
|
{% endif %} |
|
|
{% endif %} |
|
|
user.present: |
|
|
user.present: |
|
|
- name: {{ name }} |
|
|
- name: {{ name }} |
|
|
{% if user.get('createhome', True) -%} |
|
|
|
|
|
- home: {{ home }} |
|
|
- home: {{ home }} |
|
|
{% endif -%} |
|
|
|
|
|
- shell: {{ user.get('shell', current.get('shell', users.get('shell', '/bin/bash'))) }} |
|
|
- shell: {{ user.get('shell', current.get('shell', users.get('shell', '/bin/bash'))) }} |
|
|
{% if 'uid' in user -%} |
|
|
{% if 'uid' in user -%} |
|
|
- uid: {{ user['uid'] }} |
|
|
- uid: {{ user['uid'] }} |
|
|
|
|
|
|
|
|
{% if 'homephone' in user %} |
|
|
{% if 'homephone' in user %} |
|
|
- homephone: {{ user['homephone'] }} |
|
|
- homephone: {{ user['homephone'] }} |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
{% if not user.get('createhome', True) %} |
|
|
|
|
|
- createhome: False |
|
|
|
|
|
{% endif %} |
|
|
|
|
|
|
|
|
- createhome: {{ createhome }} |
|
|
{% if not user.get('unique', True) %} |
|
|
{% if not user.get('unique', True) %} |
|
|
- unique: False |
|
|
- unique: False |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
|
|
|
|
|
|
- user: {{ name }} |
|
|
- user: {{ name }} |
|
|
- source: {{ pubkey_file }} |
|
|
- source: {{ pubkey_file }} |
|
|
- require: |
|
|
- require: |
|
|
|
|
|
{% if createhome -%} |
|
|
- file: users_{{ name }}_user |
|
|
- file: users_{{ name }}_user |
|
|
|
|
|
{% endif -%} |
|
|
- user: users_{{ name }}_user |
|
|
- user: users_{{ name }}_user |
|
|
{% endfor %} |
|
|
{% endfor %} |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
|
|
|
|
|
|
- user: {{ name }} |
|
|
- user: {{ name }} |
|
|
- source: {{ pubkey_file }} |
|
|
- source: {{ pubkey_file }} |
|
|
- require: |
|
|
- require: |
|
|
|
|
|
{% if createhome -%} |
|
|
- file: users_{{ name }}_user |
|
|
- file: users_{{ name }}_user |
|
|
|
|
|
{% endif -%} |
|
|
- user: users_{{ name }}_user |
|
|
- user: users_{{ name }}_user |
|
|
{% endfor %} |
|
|
{% endfor %} |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
|
|
|
|
|
|
- user: {{ name }} |
|
|
- user: {{ name }} |
|
|
- name: {{ auth }} |
|
|
- name: {{ auth }} |
|
|
- require: |
|
|
- require: |
|
|
|
|
|
{% if createhome -%} |
|
|
- file: users_{{ name }}_user |
|
|
- file: users_{{ name }}_user |
|
|
|
|
|
{% endif -%} |
|
|
- user: users_{{ name }}_user |
|
|
- user: users_{{ name }}_user |
|
|
{% endfor %} |
|
|
{% endfor %} |
|
|
{% endif %} |
|
|
{% endif %} |