b222d26c86
As suggested in #65 (Github issue), this patch switches cronjob management from using templates to using Ansible's `cron` module. It also moves the management of the nginx-reload cronjob to `setup_ssl_lets_encrypt.yml`, which is a more fitting place for it (given that this cronjob is only required when Let's Encrypt is used). Pros: - using a module is more Ansible-ish than templating our own files in special directories - more reliable: will fail early (during playbook execution) if `/usr/bin/crontab` is not available, which is more of a guarantee that cron is working fine (idea: we should probably install some cron package using the playbook) Cons: - invocation schedule is no longer configurable, unless we define individual variables for everything or do something smart (splitting on ' ', etc.). Likely not necessary, however. - requires us to deprecate and clean-up after the old way of managing cronjobs, because it's not compatible (using the same file as before means appending additional jobs to it)
27 lines
981 B
Django/Jinja
27 lines
981 B
Django/Jinja
#!/bin/bash
|
|
|
|
# For renewal to work, matrix-nginx-proxy (or another webserver, if matrix-nginx-proxy is disabled)
|
|
# need to forward requests for `/.well-known/acme-challenge` to the certbot container.
|
|
#
|
|
# This can happen inside the container network by proxying to `http://matrix-certbot:80`
|
|
# or outside (on the host) by proxying to `http://localhost:{{ matrix_ssl_lets_encrypt_certbot_standalone_http_port }}`.
|
|
|
|
docker run \
|
|
--rm \
|
|
--name=matrix-certbot \
|
|
--network="{{ matrix_docker_network }}" \
|
|
-p 127.0.0.1:{{ matrix_ssl_lets_encrypt_certbot_standalone_http_port }}:80 \
|
|
-v {{ matrix_ssl_config_dir_path }}:/etc/letsencrypt \
|
|
-v {{ matrix_ssl_log_dir_path }}:/var/log/letsencrypt \
|
|
{{ matrix_ssl_lets_encrypt_certbot_docker_image }} \
|
|
renew \
|
|
--non-interactive \
|
|
{% if matrix_ssl_lets_encrypt_staging %}
|
|
--staging \
|
|
{% endif %}
|
|
--quiet \
|
|
--standalone \
|
|
--preferred-challenges http \
|
|
--agree-tos \
|
|
--email={{ matrix_ssl_lets_encrypt_support_email }}
|