diff --git a/examples/host-vars.yml b/examples/host-vars.yml index d7abcb93..ef911ecf 100644 --- a/examples/host-vars.yml +++ b/examples/host-vars.yml @@ -5,7 +5,7 @@ # an email notification there. # # Example value: someone@example.com -host_specific_ssl_support_email: YOUR_EMAIL_ADDRESS_HERE +host_specific_matrix_ssl_support_email: YOUR_EMAIL_ADDRESS_HERE # This is your bare domain name (`- /usr/bin/docker run --rm --name acmetool-host-grab -p 80:80 - -v {{ ssl_certs_path }}:/certs - -e ACME_EMAIL={{ ssl_support_email }} + -v {{ matrix_ssl_certs_path }}:/certs + -e ACME_EMAIL={{ matrix_ssl_support_email }} willwill/acme-docker - acmetool want {{ hostname_matrix }} {{ hostname_riot }} --xlog.severity=debug + acmetool want {{ item }} --xlog.severity=debug + with_items: + - "{{ hostname_matrix }}" + - "{{ hostname_riot }}" - name: Ensure matrix-nginx-proxy is started (if previously installed & started) service: name=matrix-nginx-proxy state=started @@ -45,6 +48,6 @@ - name: Ensure periodic SSL renewal cronjob configured template: - src: "{{ role_path }}/templates/cron.d/ssl-certificate-renewal.j2" - dest: "/etc/cron.d/ssl-certificate-renewal" + src: "{{ role_path }}/templates/cron.d/matrix-ssl-certificate-renewal.j2" + dest: "/etc/cron.d/matrix-ssl-certificate-renewal" mode: 0600 diff --git a/roles/matrix-server/tasks/setup_synapse.yml b/roles/matrix-server/tasks/setup_synapse.yml index bd5ddc7b..7cb42728 100644 --- a/roles/matrix-server/tasks/setup_synapse.yml +++ b/roles/matrix-server/tasks/setup_synapse.yml @@ -8,7 +8,6 @@ owner: "{{ matrix_user_username }}" group: "{{ matrix_user_username }}" with_items: - - "{{ matrix_synapse_base_path }}" - "{{ matrix_synapse_config_dir_path }}" - "{{ matrix_synapse_run_path }}" # We handle matrix_synapse_media_store_path below, not here, diff --git a/roles/matrix-server/templates/cron.d/matrix-periodic-restarter.j2 b/roles/matrix-server/templates/cron.d/matrix-periodic-restarter.j2 index 174eb36b..719ca253 100644 --- a/roles/matrix-server/templates/cron.d/matrix-periodic-restarter.j2 +++ b/roles/matrix-server/templates/cron.d/matrix-periodic-restarter.j2 @@ -1,8 +1,8 @@ -MAILTO="{{ ssl_support_email }}" +MAILTO="{{ matrix_ssl_support_email }}" # This periodically restarts the Matrix services # to ensure they're using the latest SSL certificate -# in case it got renewed by the `ssl-certificate-renewal` cronjob +# in case it got renewed by the `matrix-ssl-certificate-renewal` cronjob # (which happens once every ~2-3 months). # # Because `matrix-nginx-proxy.service` depends on `matrix-synapse.service`, diff --git a/roles/matrix-server/templates/cron.d/ssl-certificate-renewal.j2 b/roles/matrix-server/templates/cron.d/matrix-ssl-certificate-renewal.j2 similarity index 76% rename from roles/matrix-server/templates/cron.d/ssl-certificate-renewal.j2 rename to roles/matrix-server/templates/cron.d/matrix-ssl-certificate-renewal.j2 index cf67917f..3769bf1a 100644 --- a/roles/matrix-server/templates/cron.d/ssl-certificate-renewal.j2 +++ b/roles/matrix-server/templates/cron.d/matrix-ssl-certificate-renewal.j2 @@ -1,4 +1,4 @@ -MAILTO="{{ ssl_support_email }}" +MAILTO="{{ matrix_ssl_support_email }}" # The goal of this cronjob is to ask acmetool to check # the current SSL certificates and to see if some need renewal. @@ -18,4 +18,4 @@ MAILTO="{{ ssl_support_email }}" # These files can be retrieved via any vhost on port 80 of matrix-nginx-proxy, # because it aliases `/.well-known/acme-challenge` to that same directory. -15 4 */5 * * root /usr/bin/docker run --rm --name acmetool-host-grab --net=host -v {{ ssl_certs_path }}:/certs -v {{ ssl_certs_path }}/run:/var/run/acme -e ACME_EMAIL={{ ssl_support_email }} willwill/acme-docker acmetool --batch reconcile # --xlog.severity=debug +15 4 */5 * * root /usr/bin/docker run --rm --name acmetool-host-grab --net=host -v {{ matrix_ssl_certs_path }}:/certs -v {{ matrix_ssl_certs_path }}/run:/var/run/acme -e ACME_EMAIL={{ matrix_ssl_support_email }} willwill/acme-docker acmetool --batch reconcile # --xlog.severity=debug diff --git a/roles/matrix-server/templates/systemd/matrix-nginx-proxy.service.j2 b/roles/matrix-server/templates/systemd/matrix-nginx-proxy.service.j2 index 3b9cfbbb..5a47939b 100644 --- a/roles/matrix-server/templates/systemd/matrix-nginx-proxy.service.j2 +++ b/roles/matrix-server/templates/systemd/matrix-nginx-proxy.service.j2 @@ -17,7 +17,7 @@ ExecStart=/usr/bin/docker run --rm --name matrix-nginx-proxy \ --link matrix-synapse:synapse \ --link matrix-riot-web:riot \ -v {{ matrix_nginx_proxy_confd_path }}:/etc/nginx/conf.d \ - -v {{ ssl_certs_path }}:/acmetool-certs \ + -v {{ matrix_ssl_certs_path }}:/acmetool-certs \ {{ docker_nginx_image }} ExecStop=-/usr/bin/docker kill matrix-nginx-proxy ExecStop=-/usr/bin/docker rm matrix-nginx-proxy diff --git a/roles/matrix-server/templates/systemd/matrix-synapse.service.j2 b/roles/matrix-server/templates/systemd/matrix-synapse.service.j2 index fd755d36..e14e8d23 100644 --- a/roles/matrix-server/templates/systemd/matrix-synapse.service.j2 +++ b/roles/matrix-server/templates/systemd/matrix-synapse.service.j2 @@ -15,7 +15,7 @@ Requires=matrix-s3fs.service Type=simple ExecStartPre=-/usr/bin/docker kill matrix-synapse ExecStartPre=-/usr/bin/docker rm matrix-synapse -ExecStartPre=-{{ '/usr/bin/chown' if ansible_os_family == 'RedHat' else '/bin/chown' }} {{ matrix_user_username }}:{{ matrix_user_username }} {{ ssl_certs_path }} -R +ExecStartPre=-{{ '/usr/bin/chown' if ansible_os_family == 'RedHat' else '/bin/chown' }} {{ matrix_user_username }}:{{ matrix_user_username }} {{ matrix_ssl_certs_path }} -R ExecStart=/usr/bin/docker run --rm --name matrix-synapse \ {% if not matrix_postgres_use_external %} --link matrix-postgres:{{ matrix_postgres_connection_hostname }} \ @@ -27,7 +27,7 @@ ExecStart=/usr/bin/docker run --rm --name matrix-synapse \ -v {{ matrix_synapse_config_dir_path }}:/data \ -v {{ matrix_synapse_run_path }}:/matrix-run \ -v {{ matrix_synapse_media_store_path }}:/matrix-media-store \ - -v {{ ssl_certs_path }}:/acmetool-certs \ + -v {{ matrix_ssl_certs_path }}:/acmetool-certs \ {{ docker_matrix_image }} ExecStop=-/usr/bin/docker kill matrix-synapse ExecStop=-/usr/bin/docker rm matrix-synapse