Matrix Docker Ansible eploy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 

68 строки
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-host-grab -p 80:80
  45. -v {{ matrix_ssl_certs_path }}:/certs
  46. -e ACME_EMAIL={{ matrix_ssl_support_email }}
  47. willwill/acme-docker
  48. acmetool want {{ item }} --xlog.severity=debug
  49. with_items: "{{ domains_to_obtain_certificate_for }}"
  50. - name: Ensure matrix-nginx-proxy is started (if previously installed & started)
  51. service: name=matrix-nginx-proxy state=started
  52. when: "matrix_nginx_proxy_state.status.ActiveState|default('missing') == 'active'"
  53. - name: Ensure periodic SSL renewal cronjob configured
  54. template:
  55. src: "{{ role_path }}/templates/cron.d/matrix-ssl-certificate-renewal.j2"
  56. dest: "/etc/cron.d/matrix-ssl-certificate-renewal"
  57. mode: 0600