Rename some variables

This commit is contained in:
Slavi Pantaleev
2019-02-28 11:51:09 +02:00
parent 8cac29a5d5
commit a43bcd81fe
35 changed files with 173 additions and 131 deletions

View File

@ -1,3 +1,7 @@
- import_tasks: "{{ role_path }}/tasks/sanity_check.yml"
tags:
- always
- import_tasks: "{{ role_path }}/tasks/clean_up_old_files.yml"
when: run_setup
tags:
@ -21,13 +25,9 @@
- setup-synapse
- setup-nginx-proxy
- import_tasks: "{{ role_path }}/tasks/sanity_check.yml"
tags:
- always
- import_tasks: "{{ role_path }}/tasks/self_check_dns.yml"
delegate_to: 127.0.0.1
become: false
when: run_self_check
tags:
- self-check
- self-check

View File

@ -15,15 +15,32 @@
msg: "{{ matrix_ansible_outdated_fail_msg }}"
when: "ansible_version.major == 2 and ansible_version.minor == 5 and ansible_version.revision < 2"
# This sanity check is only used to detect uppercase when people override these specific variables.
#
# If people set `host_specific_hostname_identity` without overriding other variables (the general use-case),
# we take care to lower-case it automatically and it won't cause trouble anyway.
- name: (Deprecation) Catch and report renamed settings
fail:
msg: >-
Your configuration contains a variable, which now has a different name.
Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
when: "item.old in vars"
with_items:
- {'old': 'host_specific_hostname_identity', 'new': 'matrix_domain'}
- {'old': 'hostname_identity', 'new': 'matrix_domain'}
- {'old': 'hostname_matrix', 'new': 'matrix_server_fqn_matrix'}
- {'old': 'hostname_riot', 'new': 'matrix_server_fqn_riot'}
- name: Fail if required variables are undefined
fail:
msg: "The `{{ item }}` variable must be defined and have a non-null value"
with_items:
- matrix_domain
- matrix_server_fqn_matrix
- matrix_server_fqn_riot
when: "item not in vars or vars[item] is none"
- name: Fail if uppercase domain used
fail:
msg: "Detected that you're using an uppercase domain name - `{{ item }}`. This will cause trouble. Please use all-lowercase!"
when: "item != item|lower"
with_items:
- "{{ hostname_identity }}"
- "{{ hostname_matrix }}"
- "{{ hostname_riot }}"
- "{{ matrix_domain }}"
- "{{ matrix_server_fqn_matrix }}"
- "{{ matrix_server_fqn_riot }}"
when: "item != item|lower"

View File

@ -4,16 +4,16 @@
set_fact:
dns_srv_record_checks:
- service_and_protocol: "_matrix._tcp"
domain: "{{ (hostname_identity + '.') }}"
expected_target: "{{ (hostname_matrix + '.') }}"
domain: "{{ (matrix_domain + '.') }}"
expected_target: "{{ (matrix_server_fqn_matrix + '.') }}"
expected_port: 8448
- block:
- set_fact:
dns_srv_record_check_mxisd:
service_and_protocol: "_matrix-identity._tcp"
domain: "{{ (hostname_identity + '.') }}"
expected_target: "{{ (hostname_matrix + '.') }}"
domain: "{{ (matrix_domain + '.') }}"
expected_target: "{{ (matrix_server_fqn_matrix + '.') }}"
expected_port: 443
- name: Determine domains that we require certificates for (mxisd)
@ -25,4 +25,4 @@
include_tasks: "{{ role_path }}/tasks/self_check_dns_srv.yml"
with_items: "{{ dns_srv_record_checks }}"
loop_control:
loop_var: dns_srv_record_check
loop_var: dns_srv_record_check