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.
 
 

25 lines
985 B

  1. ---
  2. - name: Check DNS SRV record
  3. shell:
  4. cmd: "dig -t srv {{ ('_matrix._tcp.' + hostname_identity + '.')|quote }}"
  5. register: result_dig_srv
  6. changed_when: false
  7. ignore_errors: true
  8. - name: Fail if dig failed
  9. fail:
  10. msg: "Failed checking DNS SRV record. You likely don't have the `dig` program installed locally. Full error: {{ result_dig_srv }}"
  11. when: "result_dig_srv.stderr != ''"
  12. # We expect an answer like this:
  13. # ;; ANSWER SECTION:
  14. # _matrix._tcp.DOMAIN. 10800 IN SRV 10 0 8448 matrix.DOMAIN.
  15. - name: Fail if DNS SRV record incorrect
  16. fail:
  17. msg: "It appears the DNS SRV record for {{ hostname_identity }} is not set up correctly. See the 'Configuring DNS' documentation for this playbook. Full DNS answer was: {{ result_dig_srv.stdout }}"
  18. when: "('8448 ' + hostname_matrix) not in result_dig_srv.stdout"
  19. - name: Report correct DNS SRV record
  20. debug:
  21. msg: "The DNS SRV record for {{ hostname_identity }} points to {{ hostname_matrix }}, as expected"