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.
 
 

24 lines
1.1 KiB

  1. ---
  2. # This requires the dnspython library and will fail with a friendly error when unavailable.
  3. - name: Check DNS SRV record
  4. set_fact:
  5. result_dig_srv: "{{ lookup('dig', ('_matrix._tcp.' + hostname_identity + './SRV'), 'flat=0', wantlist=False) }}"
  6. - name: Fail if DNS SRV record missing
  7. fail:
  8. msg: "It appears the DNS SRV record for {{ hostname_identity }} is not set up correctly (the record is missing). See the 'Configuring DNS' documentation for this playbook."
  9. when: "result_dig_srv == 'NXDOMAIN'"
  10. - name: Fail if DNS SRV record incorrect
  11. fail:
  12. msg: >
  13. It appears the DNS SRV record for {{ hostname_identity }} is not set up correctly.
  14. Expected it to point to `{{ (hostname_matrix + '.') }}` (port 8448).
  15. Found it pointing to `{{ result_dig_srv.target }}` (port {{ result_dig_srv.port }}).
  16. See the 'Configuring DNS' documentation for this playbook.
  17. when: "result_dig_srv.target != (hostname_matrix + '.') or result_dig_srv.port != 8448"
  18. - name: Report correct DNS SRV record
  19. debug:
  20. msg: "The DNS SRV record for {{ hostname_identity }} points to {{ hostname_matrix }}, as expected"