From 4ba35247ed742393367968db34ff61a6b07f6695 Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Fri, 22 Nov 2019 15:20:16 +0000 Subject: [PATCH 1/2] test(pillar/nginx.sls): add reprodicible snippet based on issue #241 --- test/salt/default/pillar/nginx.sls | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/salt/default/pillar/nginx.sls b/test/salt/default/pillar/nginx.sls index 04e9aa4..ef6ccfa 100644 --- a/test/salt/default/pillar/nginx.sls +++ b/test/salt/default/pillar/nginx.sls @@ -37,3 +37,6 @@ nginx: - location ~ .htm: - try_files: '$uri $uri/ =404' - include: 'snippets/letsencrypt.conf' + dh_param: + 'mydhparam2.pem': + keysize: 2048 From 297e3ac400707cdd8f396da4c23ba30fc719a2cd Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Fri, 22 Nov 2019 15:41:06 +0000 Subject: [PATCH 2/2] fix(certificates.sls): prepare `certificates_path` dir separately * Close #241 --- nginx/certificates.sls | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nginx/certificates.sls b/nginx/certificates.sls index d47f3e3..2a8330b 100644 --- a/nginx/certificates.sls +++ b/nginx/certificates.sls @@ -4,6 +4,10 @@ include: - nginx.service {% set certificates_path = salt['pillar.get']('nginx:certificates_path', '/etc/nginx/ssl') %} +prepare_certificates_path_dir: + file.directory: + - name: {{ certificates_path }} + - makedirs: True {%- for dh_param, value in salt['pillar.get']('nginx:dh_param', {}).items() %} {%- if value is string %} @@ -12,19 +16,20 @@ create_nginx_dhparam_{{ dh_param }}_key: - name: {{ certificates_path }}/{{ dh_param }} - contents_pillar: nginx:dh_param:{{ dh_param }} - makedirs: True + - require: + - file: prepare_certificates_path_dir - watch_in: - service: nginx_service {%- else %} generate_nginx_dhparam_{{ dh_param }}_key: pkg.installed: - name: {{ nginx.lookup.openssl_package }} - file.directory: - - name: {{ certificates_path }} - - makedirs: True cmd.run: - name: openssl dhparam -out {{ dh_param }} {{ value.get('keysize', 2048) }} - cwd: {{ certificates_path }} - creates: {{ certificates_path }}/{{ dh_param }} + - require: + - file: prepare_certificates_path_dir - watch_in: - service: nginx_service {%- endif %}