Matrix Docker Ansible eploy
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

69 wiersze
2.4 KiB

  1. ---
  2. - name: Determine domains to obtain certificates for (Matrix)
  3. set_fact:
  4. domains_to_obtain_certificate_for: "['{{ hostname_matrix }}']"
  5. - name: Determine domains to obtain certificates for (Riot)
  6. set_fact:
  7. domains_to_obtain_certificate_for: "{{ domains_to_obtain_certificate_for + [hostname_riot] }}"
  8. when: matrix_riot_web_enabled
  9. - name: Allow access to HTTP/HTTPS in firewalld
  10. firewalld:
  11. service: "{{ item }}"
  12. state: enabled
  13. immediate: yes
  14. permanent: yes
  15. with_items:
  16. - http
  17. - https
  18. when: ansible_os_family == 'RedHat'
  19. - name: Ensure acmetool Docker image is pulled
  20. docker_image:
  21. name: willwill/acme-docker
  22. # Granting +rx to others as well, because the `nginx` user from within
  23. # matrix-nginx-proxy needs to be able to read the acme-challenge files inside
  24. # for renewal purposes.
  25. #
  26. # This should not be causing security trouble outside of the container,
  27. # as the parent directory (/matrix) does not allow "others" to access it or any of its children.
  28. # Still, it works when the /ssl subtree is mounted in the container.
  29. - name: Ensure SSL certificates path exists
  30. file:
  31. path: "{{ matrix_ssl_certs_path }}"
  32. state: directory
  33. mode: 0775
  34. owner: "{{ matrix_user_username }}"
  35. group: "{{ matrix_user_username }}"
  36. - name: Check matrix-nginx-proxy state
  37. service: name=matrix-nginx-proxy
  38. register: matrix_nginx_proxy_state
  39. - name: Ensure matrix-nginx-proxy is stopped (if previously installed & started)
  40. service: name=matrix-nginx-proxy state=stopped
  41. when: "matrix_nginx_proxy_state.status.ActiveState|default('missing') == 'active'"
  42. - name: Ensure SSL certificates are marked as wanted in acmetool
  43. shell: >-
  44. /usr/bin/docker run --rm --name acmetool --net=host
  45. -v {{ matrix_ssl_certs_path }}:/certs
  46. -v {{ matrix_ssl_certs_path }}/run:/var/run/acme
  47. -e ACME_EMAIL={{ matrix_ssl_support_email }}
  48. willwill/acme-docker
  49. acmetool want {{ item }} --xlog.severity=debug
  50. with_items: "{{ domains_to_obtain_certificate_for }}"
  51. - name: Ensure matrix-nginx-proxy is started (if previously installed & started)
  52. service: name=matrix-nginx-proxy state=started
  53. when: "matrix_nginx_proxy_state.status.ActiveState|default('missing') == 'active'"
  54. - name: Ensure periodic SSL renewal cronjob configured
  55. template:
  56. src: "{{ role_path }}/templates/cron.d/matrix-ssl-certificate-renewal.j2"
  57. dest: "/etc/cron.d/matrix-ssl-certificate-renewal"
  58. mode: 0600