mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2025-06-25 18:57:50 +02:00
Add self-check command
This commit is contained in:
25
roles/matrix-server/tasks/self_check/self_check_dns.yml
Normal file
25
roles/matrix-server/tasks/self_check/self_check_dns.yml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
|
||||
- name: Check DNS SRV record
|
||||
shell:
|
||||
cmd: "dig -t srv {{ ('_matrix._tcp.' + hostname_identity + '.')|quote }}"
|
||||
register: result_dig_srv
|
||||
changed_when: false
|
||||
ignore_errors: true
|
||||
|
||||
- name: Fail if dig failed
|
||||
fail:
|
||||
msg: "Failed checking DNS SRV record. You likely don't have the `dig` program installed locally. Full error: {{ result_dig_srv }}"
|
||||
when: "result_dig_srv.stderr != ''"
|
||||
|
||||
# We expect an answer like this:
|
||||
# ;; ANSWER SECTION:
|
||||
# _matrix._tcp.DOMAIN. 10800 IN SRV 10 0 8448 matrix.DOMAIN.
|
||||
- name: Fail if DNS SRV record incorrect
|
||||
fail:
|
||||
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 }}"
|
||||
when: "('8448 ' + hostname_matrix) not in result_dig_srv.stdout"
|
||||
|
||||
- name: Report correct DNS SRV record
|
||||
debug:
|
||||
msg: "The DNS SRV record for {{ hostname_identity }} points to {{ hostname_matrix }}, as expected"
|
Reference in New Issue
Block a user