Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

54 lines
1.6 KiB

  1. ---
  2. - name: Allow access to HTTP/HTTPS in firewalld
  3. firewalld:
  4. service: "{{ item }}"
  5. state: enabled
  6. immediate: yes
  7. permanent: yes
  8. with_items:
  9. - http
  10. - https
  11. when: ansible_os_family == 'RedHat'
  12. - name: Ensure acmetool Docker image is pulled
  13. docker_image:
  14. name: willwill/acme-docker
  15. - name: Ensure SSL certificates path exists
  16. file:
  17. path: "{{ matrix_ssl_certs_path }}"
  18. state: directory
  19. mode: 0770
  20. owner: "{{ matrix_user_username }}"
  21. group: "{{ matrix_user_username }}"
  22. - name: Check matrix-nginx-proxy state
  23. service: name=matrix-nginx-proxy
  24. register: matrix_nginx_proxy_state
  25. - name: Ensure matrix-nginx-proxy is stopped (if previously installed & started)
  26. service: name=matrix-nginx-proxy state=stopped
  27. when: "matrix_nginx_proxy_state.status.ActiveState|default('missing') == 'active'"
  28. - name: Ensure SSL certificates are marked as wanted in acmetool
  29. shell: >-
  30. /usr/bin/docker run --rm --name acmetool-host-grab -p 80:80
  31. -v {{ matrix_ssl_certs_path }}:/certs
  32. -e ACME_EMAIL={{ matrix_ssl_support_email }}
  33. willwill/acme-docker
  34. acmetool want {{ item }} --xlog.severity=debug
  35. with_items:
  36. - "{{ hostname_matrix }}"
  37. - "{{ hostname_riot }}"
  38. - name: Ensure matrix-nginx-proxy is started (if previously installed & started)
  39. service: name=matrix-nginx-proxy state=started
  40. when: "matrix_nginx_proxy_state.status.ActiveState|default('missing') == 'active'"
  41. - name: Ensure periodic SSL renewal cronjob configured
  42. template:
  43. src: "{{ role_path }}/templates/cron.d/matrix-ssl-certificate-renewal.j2"
  44. dest: "/etc/cron.d/matrix-ssl-certificate-renewal"
  45. mode: 0600