Merge pull request #123 from myii/PR_multi-line-authorized_keys

Use `contents_pillar` to work with multi-line authorized_keys file
This commit is contained in:
Forrest 2016-07-03 12:55:41 -07:00 committed by GitHub
commit 7bd4e9080b
2 changed files with 13 additions and 6 deletions

View File

@ -11,7 +11,9 @@ users:
# WARNING: If 'empty_password' is set to True, the 'password' statement # WARNING: If 'empty_password' is set to True, the 'password' statement
# will be ignored by enabling password-less login for the user. # will be ignored by enabling password-less login for the user.
empty_password: False empty_password: False
system: False
home: /custom/buser home: /custom/buser
user_dir_mode: 750
createhome: True createhome: True
roomnumber: "A-1" roomnumber: "A-1"
workphone: "(555) 555-5555" workphone: "(555) 555-5555"
@ -34,6 +36,7 @@ users:
sudo_defaults: sudo_defaults:
- '!requiretty' - '!requiretty'
shell: /bin/bash shell: /bin/bash
remove_groups: False
prime_group: prime_group:
name: primarygroup name: primarygroup
gid: 500 gid: 500

View File

@ -207,9 +207,8 @@ users_authorized_keys_{{ name }}:
{{ auth }} {{ auth }}
{% endfor -%} {% endfor -%}
{% else %} {% else %}
- contents: | {%- for key_name, pillar_name in user['ssh_auth_pillar'].items() %}
{%- for key_name, pillar_name in user['ssh_auth_pillar'].iteritems() %} - contents_pillar: {{ pillar_name }}:{{ key_name }}:pubkey
{{ salt['pillar.get'](pillar_name + ':' + key_name + ':pubkey', '') }}
{%- endfor %} {%- endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}
@ -385,6 +384,11 @@ users_{{ users.sudoers_dir }}/{{ name }}:
{%- endfor %} {%- endfor %}
{%- endif %} {%- endif %}
{%- if 'sudo_rules' in user %} {%- if 'sudo_rules' in user %}
########################################################################
# File managed by Salt (users-formula).
# Your changes will be overwritten.
########################################################################
#
{%- for rule in user['sudo_rules'] %} {%- for rule in user['sudo_rules'] %}
{{ name }} {{ rule }} {{ name }} {{ rule }}
{%- endfor %} {%- endfor %}