Matrix Docker Ansible eploy
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

137 linhas
8.5 KiB

  1. ---
  2. - name: (Deprecation) Catch and report renamed settings
  3. ansible.builtin.fail:
  4. msg: >-
  5. Your configuration contains a variable, which now has a different name.
  6. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
  7. when: "item.old in vars"
  8. with_items:
  9. - {'old': 'matrix_nginx_proxy_matrix_client_api_addr_with_proxy_container', 'new': 'matrix_nginx_proxy_proxy_matrix_client_api_addr_with_container'}
  10. - {'old': 'matrix_nginx_proxy_matrix_client_api_addr_sans_proxy_container', 'new': 'matrix_nginx_proxy_proxy_matrix_client_api_addr_sans_container'}
  11. # People who configured this to disable Riot, would now wish to be disabling Element.
  12. # We now also have `matrix_nginx_proxy_proxy_riot_compat_redirect_`, but that's something else and is disabled by default.
  13. - {'old': 'matrix_nginx_proxy_proxy_riot_enabled', 'new': 'matrix_nginx_proxy_proxy_element_enabled'}
  14. - {'old': 'matrix_ssl_lets_encrypt_renew_cron_time_definition', 'new': '<not configurable anymore>'}
  15. - {'old': 'matrix_nginx_proxy_reload_cron_time_definition', 'new': '<not configurable anymore>'}
  16. - name: Fail on unknown matrix_ssl_retrieval_method
  17. ansible.builtin.fail:
  18. msg: >-
  19. `matrix_ssl_retrieval_method` needs to be set to a known value.
  20. when: "matrix_ssl_retrieval_method not in ['lets-encrypt', 'self-signed', 'manually-managed', 'none']"
  21. - name: Fail on unknown matrix_nginx_proxy_ssl_config
  22. ansible.builtin.fail:
  23. msg: >-
  24. `matrix_nginx_proxy_ssl_preset` needs to be set to a known value.
  25. when: "matrix_nginx_proxy_ssl_preset not in ['modern', 'intermediate', 'old']"
  26. - name: Fail if Basic Auth enabled for metrics, but no credentials supplied
  27. ansible.builtin.fail:
  28. msg: |
  29. Enabling Basic Auth for metrics (`matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_enabled`) requires:
  30. - either a username/password (provided in `matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_username` and `matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_password`)
  31. - or raw htpasswd content (provided in `matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_raw_content`)
  32. when: "matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_enabled | bool and (matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_raw_content == '' and (matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_username == '' or matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_password == ''))"
  33. - block:
  34. - name: (Deprecation) Catch and report renamed settings
  35. ansible.builtin.fail:
  36. msg: >-
  37. Your configuration contains a variable, which now has a different name.
  38. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
  39. with_items:
  40. - {'old': 'host_specific_matrix_ssl_support_email', 'new': 'matrix_ssl_lets_encrypt_support_email'}
  41. - {'old': 'host_specific_matrix_ssl_lets_encrypt_support_email', 'new': 'matrix_ssl_lets_encrypt_support_email'}
  42. - {'old': 'matrix_nginx_proxy_proxy_synapse_workers_enabled_list', 'new': '<no longer used>'}
  43. when: "item.old in vars"
  44. - name: Fail if required variables are undefined
  45. ansible.builtin.fail:
  46. msg: "The `{{ item }}` variable must be defined and have a non-null value"
  47. with_items:
  48. - "matrix_ssl_lets_encrypt_support_email"
  49. - "matrix_nginx_proxy_proxy_synapse_federation_api_addr_sans_container"
  50. - "matrix_nginx_proxy_proxy_synapse_federation_api_addr_with_container"
  51. - "matrix_nginx_proxy_proxy_synapse_client_api_addr_with_container"
  52. - "matrix_nginx_proxy_proxy_synapse_client_api_addr_sans_container"
  53. - "matrix_ssl_lets_encrypt_certbot_challenge_image"
  54. when: "vars[item] == '' or vars[item] is none"
  55. - name: "Fail if unsupported matrix_ssl_lets_encrypt_certbot_challenge_image"
  56. ansible.builtin.fail:
  57. msg: >-
  58. `matrix_ssl_lets_encrypt_certbot_challenge_image` must be set to a known value: 'http' (default), 'dns' or 'custom'.
  59. when: "matrix_ssl_lets_encrypt_certbot_challenge_image not in ['http', 'dns', 'custom']"
  60. - name: "Fail if custom certbot image is missing when required"
  61. ansible.builtin.fail:
  62. msg: >-
  63. No `matrix_ssl_lets_encrypt_certbot_custom_docker_image` has been provided while `matrix_ssl_lets_encrypt_certbot_challenge_image` is set to 'custom'.
  64. when: "matrix_ssl_lets_encrypt_certbot_challenge_image == 'custom' and (matrix_ssl_lets_encrypt_certbot_custom_docker_image == '' or matrix_ssl_lets_encrypt_certbot_custom_docker_image is none)"
  65. - name: "Fail if DNS certbot official image is not supported"
  66. ansible.builtin.fail:
  67. msg: >-
  68. `matrix_ssl_lets_encrypt_certbot_official_dns_provider` needs to be set to a known value.
  69. when: "matrix_ssl_lets_encrypt_certbot_challenge_image == 'dns' and matrix_ssl_lets_encrypt_certbot_official_dns_provider not in ['cloudflare', 'cloudxns', 'digitalocean', 'dnsmadeeasy', 'dnssimple', 'gehirn', 'google', 'linode', 'luadns', 'nsone', 'ovh', 'rfc2136', 'route53', 'sakuracloud']"
  70. - block:
  71. - name: "Fail if DNS challenge configured with image supporting only HTTP challenge"
  72. ansible.builtin.fail:
  73. msg: >-
  74. `matrix_ssl_lets_encrypt_dns_challenge_domains` is defined but the configured image doesn't support DNS challenges.
  75. when: matrix_ssl_lets_encrypt_certbot_challenge_image not in ['dns', 'custom']
  76. - name: "Fail if required variables are undefined for an entry of `matrix_ssl_lets_encrypt_dns_challenge_domains`"
  77. ansible.builtin.fail:
  78. msg: >-
  79. The `{{ item[1] }}` variable must be defined for configuration `{{ item[0] }}`
  80. loop: "{{ matrix_ssl_lets_encrypt_dns_challenge_domains | product(['domain', 'provider', 'config_file']) | list }}"
  81. when: "item[0][item[1]] is not defined"
  82. - name: "Fail if domain configured for DNS challenge is unkown"
  83. ansible.builtin.fail:
  84. msg: >-
  85. The domain `{{ dns_challenge_domain.domain }}` is not in the list of domains for which a certificate will be requested.
  86. The associated module might be enabled or it might be added to `matrix_ssl_additional_domains_to_obtain_certificates_for`.
  87. with_items: "{{ matrix_ssl_lets_encrypt_dns_challenge_domains }}"
  88. loop_control:
  89. loop_var: dns_challenge_domain
  90. when: "dns_challenge_domain.domain not in matrix_ssl_domains_to_obtain_certificates_for | list"
  91. - name: "Fail if DNS provider is not supported"
  92. ansible.builtin.fail:
  93. msg: >-
  94. The DNS provider `{{ dns_challenge_domain.provider }}` is not supported for DNS challenges.
  95. with_items: "{{ matrix_ssl_lets_encrypt_dns_challenge_domains }}"
  96. loop_control:
  97. loop_var: dns_challenge_domain
  98. when: "dns_challenge_domain.provider not in ['cloudflare', 'cloudxns', 'digitalocean', 'dnsmadeeasy', 'dnssimple', 'gehirn', 'google', 'linode', 'luadns', 'nsone', 'ovh', 'rfc2136', 'route53', 'sakuracloud']"
  99. - name: "Fail if DNS provider configuration is missing"
  100. ansible.builtin.fail:
  101. msg: >-
  102. The configuration file `{{ dns_challenge_domain.config_file }}` is not declared in `matrix_ssl_lets_encrypt_dns_config`.
  103. with_items: "{{ matrix_ssl_lets_encrypt_dns_challenge_domains }}"
  104. loop_control:
  105. loop_var: dns_challenge_domain
  106. when: "dns_challenge_domain.config_file not in matrix_ssl_lets_encrypt_dns_config | map(attribute='name') | list"
  107. when: "(matrix_ssl_lets_encrypt_dns_challenge_domains is defined) and (matrix_ssl_lets_encrypt_dns_challenge_domains | length > 0)"
  108. when: "matrix_ssl_retrieval_method == 'lets-encrypt'"
  109. - name: (Deprecation) Catch and report old metrics usage
  110. ansible.builtin.fail:
  111. msg: >-
  112. Your configuration contains a variable (`{{ item }}`), which refers to the old metrics collection system for Synapse,
  113. which exposed metrics on `https://matrix.DOMAIN/_synapse/metrics` and `https://matrix.DOMAIN/_synapse-worker-TYPE-ID/metrics`.
  114. We now recommend exposing Synapse metrics in another way, from another URL.
  115. Refer to the changelog for more details: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/CHANGELOG.md#2022-06-22
  116. with_items:
  117. - matrix_nginx_proxy_proxy_synapse_metrics
  118. - matrix_nginx_proxy_proxy_synapse_metrics_basic_auth_enabled
  119. - matrix_nginx_proxy_proxy_synapse_metrics_basic_auth_key
  120. when: "item in vars"