From e6603ae62a0ffc30e89ca304162f0bad271d9483 Mon Sep 17 00:00:00 2001 From: Pandu E Poluan Date: Mon, 1 Aug 2016 23:59:11 +0700 Subject: [PATCH] Allow moduli to be pulled as file Added Jinja logic to allow the option to pull the moduli from an online source. --- openssh/moduli.sls | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/openssh/moduli.sls b/openssh/moduli.sls index d871006..7e0bd3a 100644 --- a/openssh/moduli.sls +++ b/openssh/moduli.sls @@ -1,8 +1,19 @@ {% from "openssh/map.jinja" import openssh with context %} -{% if salt['pillar.get']('openssh:moduli', False) %} +{% set moduli = salt['pillar.get']('openssh:moduli', False) -%} +{% set moduli_source = salt['pillar.get']('openssh:moduli_source', False) -%} +{% if moduli or moduli_source -%} ssh_moduli: file.managed: - name: {{ openssh.ssh_moduli }} + {% if moduli -%} + # Although we have the contents of the moduli in the variable 'moduli', + # inlining the variable here *will* cause problems. Using the '|' literal string indicator + # Necessitates using the '|indent' filter, and this is too complex. + # Rather, let salt read the pillar itself. - contents_pillar: openssh:moduli + {% elif moduli_source -%} + - source: {{ moduli_source }} + - source_hash: {{ moduli_source|trim }}.hash + {%- endif %} {% endif %}