瀏覽代碼

Merge pull request #61 from daschatten/master

Add 'ssh_auth_file' pillar key to generate an authorized_keys file from ...
lookup-fix-3
Florian Bittner 9 年之前
父節點
當前提交
d827b4fb86
共有 2 個檔案被更改,包括 15 行新增0 行删除
  1. +4
    -0
      pillar.example
  2. +11
    -0
      users/init.sls

+ 4
- 0
pillar.example 查看文件

@@ -28,6 +28,10 @@ users:
- PUBLICKEY
ssh_auth.absent:
- PUBLICKEY_TO_BE_REMOVED
# Generates an authorized_keys file for the user
# with the given keys
ssh_auth_file:
- PUBLICKEY
google_auth:
ssh: |
SOMEGAUTHHASHVAL

+ 11
- 0
users/init.sls 查看文件

@@ -142,6 +142,17 @@ user_{{ name }}_public_key:
{% endfor %}
{% endif %}

{% if 'ssh_auth_file' in user %}
{{ home }}/.ssh/authorized_keys:
file.managed:
- user: {{ name }}
- group: {{ name }}
- mode: 600
- contents: |
{% for auth in user.ssh_auth_file -%}
{{ auth }}
{% endfor -%}
{% endif %}

{% if 'ssh_auth' in user %}
{% for auth in user['ssh_auth'] %}

Loading…
取消
儲存