mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2025-10-26 10:03:25 +00:00
Switch to managing cronjobs with the Ansible cron module
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)
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
- "matrix-synapse.conf"
|
||||
- "matrix-riot-web.conf"
|
||||
|
||||
|
||||
#
|
||||
# Tasks related to setting up matrix-nginx-proxy
|
||||
#
|
||||
@@ -57,12 +58,6 @@
|
||||
mode: 0644
|
||||
when: matrix_nginx_proxy_enabled
|
||||
|
||||
- name: Ensure periodic restarting of matrix-nginx-proxy is configured (for SSL renewal)
|
||||
template:
|
||||
src: "{{ role_path }}/templates/cron.d/matrix-nginx-proxy-periodic-restarter.j2"
|
||||
dest: "/etc/cron.d/matrix-nginx-proxy-periodic-restarter"
|
||||
mode: 0600
|
||||
when: "matrix_nginx_proxy_enabled and matrix_ssl_retrieval_method == 'lets-encrypt'"
|
||||
|
||||
#
|
||||
# Tasks related to getting rid of matrix-nginx-proxy (if it was previously enabled)
|
||||
@@ -86,9 +81,3 @@
|
||||
path: "/etc/systemd/system/matrix-nginx-proxy.service"
|
||||
state: absent
|
||||
when: "not matrix_nginx_proxy_enabled and matrix_nginx_proxy_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure periodic restarting of matrix-nginx-proxy is removed
|
||||
file:
|
||||
path: "/etc/cron.d/matrix-nginx-proxy-periodic-restarter"
|
||||
state: absent
|
||||
when: "not matrix_nginx_proxy_enabled or matrix_ssl_retrieval_method != 'lets-encrypt'"
|
||||
|
||||
Reference in New Issue
Block a user