|
|
@@ -120,11 +120,14 @@ users_{{ name }}_user: |
|
|
|
- workphone: {{ user['workphone'] }} |
|
|
|
{% endif %} |
|
|
|
{% if 'homephone' in user %} |
|
|
|
- homephone: {{ user['workphone'] }} |
|
|
|
- homephone: {{ user['homephone'] }} |
|
|
|
{% endif %} |
|
|
|
{% if not user.get('createhome', True) %} |
|
|
|
- createhome: False |
|
|
|
{% endif %} |
|
|
|
{% if not user.get('unique', True) %} |
|
|
|
- unique: False |
|
|
|
{% endif %} |
|
|
|
{% if 'expire' in user -%} |
|
|
|
{% if grains['kernel'].endswith('BSD') and |
|
|
|
user['expire'] < 157766400 %} |
|
|
@@ -179,35 +182,35 @@ user_keydir_{{ name }}: |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
{% if 'ssh_keys' in user %} |
|
|
|
{% set key_type = 'id_' + user.get('ssh_key_type', 'rsa') %} |
|
|
|
users_user_{{ name }}_private_key: |
|
|
|
file.managed: |
|
|
|
- name: {{ home }}/.ssh/{{ key_type }} |
|
|
|
- user: {{ name }} |
|
|
|
- group: {{ user_group }} |
|
|
|
- mode: 600 |
|
|
|
- show_diff: False |
|
|
|
- contents_pillar: users:{{ name }}:ssh_keys:privkey |
|
|
|
- require: |
|
|
|
- user: users_{{ name }}_user |
|
|
|
{% for group in user.get('groups', []) %} |
|
|
|
- group: users_{{ name }}_{{ group }}_group |
|
|
|
{% endfor %} |
|
|
|
users_user_{{ name }}_public_key: |
|
|
|
{% for _key in user.ssh_keys.keys() %} |
|
|
|
{% if _key == 'privkey' %} |
|
|
|
{% set key_name = 'id_' + user.get('ssh_key_type', 'rsa') %} |
|
|
|
{% elif _key == 'pubkey' %} |
|
|
|
{% set key_name = 'id_' + user.get('ssh_key_type', 'rsa') + '.pub' %} |
|
|
|
{% else %} |
|
|
|
{% set key_name = _key %} |
|
|
|
{% endif %} |
|
|
|
users_{{ name }}_{{ key_name }}_key: |
|
|
|
file.managed: |
|
|
|
- name: {{ home }}/.ssh/{{ key_type }}.pub |
|
|
|
- name: {{ home }}/.ssh/{{ key_name }} |
|
|
|
- user: {{ name }} |
|
|
|
- group: {{ user_group }} |
|
|
|
{% if key_name.endswith(".pub") %} |
|
|
|
- mode: 644 |
|
|
|
{% else %} |
|
|
|
- mode: 600 |
|
|
|
{% endif %} |
|
|
|
- show_diff: False |
|
|
|
- contents_pillar: users:{{ name }}:ssh_keys:pubkey |
|
|
|
- contents_pillar: users:{{ name }}:ssh_keys:{{ _key }} |
|
|
|
- require: |
|
|
|
- user: users_{{ name }}_user |
|
|
|
{% for group in user.get('groups', []) %} |
|
|
|
- group: users_{{ name }}_{{ group }}_group |
|
|
|
{% endfor %} |
|
|
|
{% endfor %} |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
|
|
|
|
{% if 'ssh_auth_file' in user or 'ssh_auth_pillar' in user %} |
|
|
|
users_authorized_keys_{{ name }}: |
|
|
|
file.managed: |
|
|
@@ -221,8 +224,9 @@ users_authorized_keys_{{ name }}: |
|
|
|
{{ auth }} |
|
|
|
{% endfor -%} |
|
|
|
{% else %} |
|
|
|
- contents: | |
|
|
|
{%- for key_name, pillar_name in user['ssh_auth_pillar'].items() %} |
|
|
|
- contents_pillar: {{ pillar_name }}:{{ key_name }}:pubkey |
|
|
|
{{ salt['pillar.get'](pillar_name + ':' + key_name + ':pubkey', '') }} |
|
|
|
{%- endfor %} |
|
|
|
{% endif %} |
|
|
|
{% endif %} |
|
|
@@ -466,7 +470,7 @@ users_googleauth-{{ svc }}-{{ name }}: |
|
|
|
{% if 'gitconfig' in user %} |
|
|
|
{% for key, value in user['gitconfig'].items() %} |
|
|
|
users_{{ name }}_user_gitconfig_{{ loop.index0 }}: |
|
|
|
{% if grains['saltversioninfo'] >= (2015, 8, 0, 0) %} |
|
|
|
{% if grains['saltversioninfo'] >= [2015, 8, 0, 0] %} |
|
|
|
git.config_set: |
|
|
|
{% else %} |
|
|
|
git.config: |
|
|
@@ -474,7 +478,7 @@ users_{{ name }}_user_gitconfig_{{ loop.index0 }}: |
|
|
|
- name: {{ key }} |
|
|
|
- value: "{{ value }}" |
|
|
|
- user: {{ name }} |
|
|
|
{% if grains['saltversioninfo'] >= (2015, 8, 0, 0) %} |
|
|
|
{% if grains['saltversioninfo'] >= [2015, 8, 0, 0] %} |
|
|
|
- global: True |
|
|
|
{% else %} |
|
|
|
- is_global: True |