diff --git a/letsencrypt/config.sls b/letsencrypt/config.sls index c1cee5d..921f2e6 100644 --- a/letsencrypt/config.sls +++ b/letsencrypt/config.sls @@ -20,3 +20,5 @@ letsencrypt-config: - makedirs: true - context: config: {{ letsencrypt.config | json }} + - require: + - file: letsencrypt-config-directory diff --git a/letsencrypt/domains.sls b/letsencrypt/domains.sls index 2e552c7..a0c488f 100644 --- a/letsencrypt/domains.sls +++ b/letsencrypt/domains.sls @@ -3,6 +3,10 @@ {% from "letsencrypt/map.jinja" import letsencrypt with context %} +include: + - letsencrypt.install + - letsencrypt.config + {% if letsencrypt.install_method == 'package' %} {% set check_cert_cmd = letsencrypt._cli_path ~ ' certificates --cert-name' %} {% set renew_cert_cmd = letsencrypt._cli_path ~ ' renew' %} @@ -30,6 +34,12 @@ - template: jinja - source: salt://letsencrypt/files/check_letsencrypt_cert.sh.jinja - mode: 755 + - require: + {%- if letsencrypt.install_method == 'git' %} + - git: letsencrypt-client + {%- elif letsencrypt.install_method == 'pip' %} + - virtualenv: letsencrypt-client + {%- endif %} {{ renew_cert_cmd }}: file.{{ old_renew_cert_cmd_state }}: @@ -97,6 +107,7 @@ letsencrypt-crontab-{{ setname }}-{{ domainlist[0] }}: - hour: '{{ letsencrypt.cron.hour }}' - dayweek: '{{ letsencrypt.cron.dayweek }}' - identifier: letsencrypt-{{ setname }}-{{ domainlist[0] }} + {%- if old_cron_state == 'present' %} - require: - cmd: create-initial-cert-{{ setname }}-{{ domainlist | join('+') }} {% if letsencrypt.install_method == 'package' %} @@ -104,6 +115,7 @@ letsencrypt-crontab-{{ setname }}-{{ domainlist[0] }}: {% else %} - file: {{ renew_cert_cmd }} {% endif %} + {%- endif %} create-fullchain-privkey-pem-for-{{ setname }}: cmd.run: