소스 검색

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

Use `contents_pillar` to work with multi-line authorized_keys file
lookup-fix-3
Forrest 8 년 전
부모
커밋
7bd4e9080b
2개의 변경된 파일13개의 추가작업 그리고 6개의 파일을 삭제
  1. +3
    -0
      pillar.example
  2. +10
    -6
      users/init.sls

+ 3
- 0
pillar.example 파일 보기

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

+ 10
- 6
users/init.sls 파일 보기

@@ -207,9 +207,8 @@ users_authorized_keys_{{ name }}:
{{ auth }}
{% endfor -%}
{% else %}
- contents: |
{%- for key_name, pillar_name in user['ssh_auth_pillar'].iteritems() %}
{{ salt['pillar.get'](pillar_name + ':' + key_name + ':pubkey', '') }}
{%- for key_name, pillar_name in user['ssh_auth_pillar'].items() %}
- contents_pillar: {{ pillar_name }}:{{ key_name }}:pubkey
{%- endfor %}
{% endif %}
{% endif %}
@@ -385,6 +384,11 @@ users_{{ users.sudoers_dir }}/{{ name }}:
{%- endfor %}
{%- endif %}
{%- if 'sudo_rules' in user %}
########################################################################
# File managed by Salt (users-formula).
# Your changes will be overwritten.
########################################################################
#
{%- for rule in user['sudo_rules'] %}
{{ name }} {{ rule }}
{%- endfor %}
@@ -392,10 +396,10 @@ users_{{ users.sudoers_dir }}/{{ name }}:
- require:
- file: users_sudoer-defaults
- file: users_sudoer-{{ name }}
cmd.wait:
cmd.wait:
- name: visudo -cf {{ users.sudoers_dir }}/{{ name }} || ( rm -rvf {{ users.sudoers_dir }}/{{ name }}; exit 1 )
- watch:
- file: {{ users.sudoers_dir }}/{{ name }}
- watch:
- file: {{ users.sudoers_dir }}/{{ name }}
{% endif %}
{% else %}
users_{{ users.sudoers_dir }}/{{ name }}:

Loading…
취소
저장