mirror of
https://github.com/saltstack-formulas/openssh-formula.git
synced 2024-11-28 01:18:12 +01:00
a013b79027
Signed-off-by: René Jochum <rene@jochums.at>
43 lines
1.1 KiB
Plaintext
43 lines
1.1 KiB
Plaintext
include:
|
|
- openssh
|
|
{%- from "openssh/map.jinja" import openssh with context -%}
|
|
{%- set openssh_pillar = pillar.get('openssh', {}) -%}
|
|
{%- set auth = openssh_pillar.get('auth', {}) -%}
|
|
{%- for user,keys in auth.iteritems() -%}
|
|
{%- for key in keys -%}
|
|
{% if 'present' in key and key['present'] %}
|
|
{{ key['name'] }}:
|
|
ssh_auth.present:
|
|
- user: {{ user }}
|
|
{%- if 'source' in key %}
|
|
- source: {{ key['source'] }}
|
|
{%- else %}
|
|
{%- if 'enc' in key %}
|
|
- enc: {{ key['enc'] }}
|
|
{%- endif -%}
|
|
{%- if 'comment' in key %}
|
|
- comment: {{ key['comment'] }}
|
|
{%- endif -%}
|
|
{%- if 'options' in key %}
|
|
- options: {{ key['options'] }}
|
|
{%- endif -%}
|
|
{%- endif %}
|
|
- require:
|
|
- service: {{ openssh.service }}
|
|
{%- else %}
|
|
{{ key['name'] }}:
|
|
ssh_auth.absent:
|
|
- user: {{ user }}
|
|
{%- if 'enc' in key %}
|
|
- enc: {{ key['enc'] }}
|
|
{%- endif -%}
|
|
{%- if 'comment' in key %}
|
|
- comment: {{ key['comment'] }}
|
|
{%- endif -%}
|
|
{%- if 'options' in key %}
|
|
- options: {{ key['options'] }}
|
|
{%- endif -%}
|
|
{%- endif -%}
|
|
{%- endfor -%}
|
|
{%- endfor -%}
|