mirror of
https://github.com/saltstack-formulas/openssh-formula.git
synced 2026-10-24 01:24:57 +02:00
Remove duplicated pillar.get calls to retrieve the sshd_config and ssh_config pillars
This commit is contained in:
1 parent
463ad69d92
commit
3e01ad816a
4 files changed
+14
-16
No files matched your search
+6
-7
@@ -29,17 +29,16 @@
|
||||
|
||||
include:
|
||||
- openssh
|
||||
{%- from "openssh/map.jinja" import openssh with context -%}
|
||||
{%- set openssh_pillar = pillar.get('openssh', {}) -%}
|
||||
{%- set auth = openssh_pillar.get('auth', {}) -%}
|
||||
{%- from "openssh/map.jinja" import openssh, sshd_config with context -%}
|
||||
{%- set auth = openssh.get('auth', {}) -%}
|
||||
{%- for identifier,keys in auth.items() -%}
|
||||
{%- for key in keys -%}
|
||||
{% if 'present' in key and key['present'] %}
|
||||
{{ print_name(identifier, key) }}:
|
||||
ssh_auth.present:
|
||||
{{ print_ssh_auth(identifier, key) }}
|
||||
{%- if 'sshd_config' in pillar and 'AuthorizedKeysFile' in pillar['sshd_config'] %}
|
||||
- config: '{{ pillar['sshd_config']['AuthorizedKeysFile'] }}'
|
||||
{%- if sshd_config.get("AuthorizedKeysFile", None) %}
|
||||
- config: '{{ sshd_config['AuthorizedKeysFile'] }}'
|
||||
{% endif %}
|
||||
- require:
|
||||
- service: {{ openssh.service }}
|
||||
@@ -47,8 +46,8 @@ include:
|
||||
{{ print_name(identifier, key) }}:
|
||||
ssh_auth.absent:
|
||||
{{ print_ssh_auth(identifier, key) }}
|
||||
{%- if 'sshd_config' in pillar and 'AuthorizedKeysFile' in pillar['sshd_config'] %}
|
||||
- config: '{{ pillar['sshd_config']['AuthorizedKeysFile'] }}'
|
||||
{%- if sshd_config.get("AuthorizedKeysFile", None) %}
|
||||
- config: '{{ sshd_config['AuthorizedKeysFile'] }}'
|
||||
{% endif -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
|
||||
Reference in new issue
Block a user