From f55445211c8247ffc706ee0f0a60753578553b0a Mon Sep 17 00:00:00 2001 From: POTIER Mathieu Date: Wed, 18 Nov 2015 20:33:50 +0100 Subject: [PATCH] Specify config clause only if defined in pillar. Signed-off-by: POTIER Mathieu --- openssh/auth.sls | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openssh/auth.sls b/openssh/auth.sls index e74c8c5..2bf04a8 100644 --- a/openssh/auth.sls +++ b/openssh/auth.sls @@ -38,14 +38,18 @@ include: {{ 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'] }} + {% endif -%} - require: - service: {{ openssh.service }} {%- else %} {{ 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'] }} + {% endif -%} {%- endif -%} {%- endfor -%} {%- endfor -%} \ No newline at end of file