aboutsummaryrefslogtreecommitdiffstats
path: root/roles/web/templates/acme/deploy.sh.j2
blob: 141b1123cea2adccf43d0a0d574778fa735351d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
#
# Deploy the issued certificates.
#
# Aaron LI
# 2019-09-21
#

SSL_ROOT="{{ web.ssl_root }}"
[ -d "${SSL_ROOT}" ] || mkdir -p -m 0700 ${SSL_ROOT}

{% for domain in domains %}
CERT_DIR="${SSL_ROOT}/{{ domain.name }}"
[ -d "${CERT_DIR}" ] || mkdir -m 0700 ${CERT_DIR}
acme.sh --install-cert --log /var/log/acme.sh.log \
    --config-home {{ web.acme_home }}/.acme.sh \
    --cert-home {{ web.acme_home }}/certs \
    --domain {{ domain.name }} \
    --key-file ${CERT_DIR}/key \
    --cert-file ${CERT_DIR}/cert \
    --fullchain-file ${CERT_DIR}/fullchain

{% endfor %}

echo "Reload relevant services ..."
SCRIPT="{{ web.acme_home }}/deploy.local.sh"
[ -f "${SCRIPT}" ] && sh ${SCRIPT} || exit 0