Rename playbook variables so they are consistently prefixed
Pretty much all variables live in their own `matrix_<whatever>` prefix now and are grouped closer together in the default variables file (`roles/matrix-server/defaults/main.yml`).
This commit is contained in:
		@@ -52,7 +52,7 @@
 | 
			
		||||
- name: Importing SQLite database into Postgres
 | 
			
		||||
  docker_container:
 | 
			
		||||
    name: matrix-synapse-migrate
 | 
			
		||||
    image: "{{ matrix_docker_image_synapse }}"
 | 
			
		||||
    image: "{{ matrix_synapse_docker_image }}"
 | 
			
		||||
    detach: no
 | 
			
		||||
    cleanup: yes
 | 
			
		||||
    entrypoint: /usr/bin/python
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure Coturn image is pulled
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ matrix_docker_image_coturn }}"
 | 
			
		||||
    name: "{{ matrix_coturn_docker_image }}"
 | 
			
		||||
 | 
			
		||||
- name: Ensure Coturn configuration path exists
 | 
			
		||||
  file:
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure Goofys Docker image is pulled
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ matrix_docker_image_goofys }}"
 | 
			
		||||
    name: "{{ matrix_s3_goofys_docker_image }}"
 | 
			
		||||
  when: matrix_s3_media_store_enabled
 | 
			
		||||
 | 
			
		||||
# This will throw a Permission Denied error if already mounted
 | 
			
		||||
@@ -65,6 +65,6 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure Goofys Docker image doesn't exist
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ matrix_docker_image_goofys }}"
 | 
			
		||||
    name: "{{ matrix_s3_goofys_docker_image }}"
 | 
			
		||||
    state: absent
 | 
			
		||||
  when: "not matrix_s3_media_store_enabled"
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure mailer image is pulled
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ matrix_docker_image_mailer }}"
 | 
			
		||||
    name: "{{ matrix_mailer_docker_image }}"
 | 
			
		||||
  when: matrix_mailer_enabled
 | 
			
		||||
 | 
			
		||||
- name: Ensure matrix-mailer.service installed
 | 
			
		||||
@@ -51,6 +51,6 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure mailer Docker image doesn't exist
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ matrix_docker_image_mailer }}"
 | 
			
		||||
    name: "{{ matrix_mailer_docker_image }}"
 | 
			
		||||
    state: absent
 | 
			
		||||
  when: "not matrix_mailer_enabled"
 | 
			
		||||
@@ -23,7 +23,7 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure mxisd image is pulled
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ matrix_docker_image_mxisd }}"
 | 
			
		||||
    name: "{{ matrix_mxisd_docker_image }}"
 | 
			
		||||
  when: matrix_mxisd_enabled
 | 
			
		||||
 | 
			
		||||
- name: Ensure mxisd config installed
 | 
			
		||||
@@ -69,6 +69,6 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure mxisd Docker image doesn't exist
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ matrix_docker_image_mxisd }}"
 | 
			
		||||
    name: "{{ matrix_mxisd_docker_image }}"
 | 
			
		||||
    state: absent
 | 
			
		||||
  when: "not matrix_mxisd_enabled"
 | 
			
		||||
@@ -36,7 +36,7 @@
 | 
			
		||||
#
 | 
			
		||||
- name: Ensure nginx Docker image is pulled
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ matrix_docker_image_nginx }}"
 | 
			
		||||
    name: "{{ matrix_nginx_proxy_docker_image }}"
 | 
			
		||||
  when: matrix_nginx_proxy_enabled
 | 
			
		||||
 | 
			
		||||
- name: Allow access to nginx proxy ports in firewalld
 | 
			
		||||
 
 | 
			
		||||
@@ -26,21 +26,21 @@
 | 
			
		||||
 | 
			
		||||
- name: Determine Postgres version to use (default to latest)
 | 
			
		||||
  set_fact:
 | 
			
		||||
    matrix_docker_image_postgres_to_use: "{{ matrix_docker_image_postgres_latest }}"
 | 
			
		||||
    matrix_postgres_docker_image_to_use: "{{ matrix_postgres_docker_image_latest }}"
 | 
			
		||||
 | 
			
		||||
- name: Determine Postgres version to use (use 9.x, if detected)
 | 
			
		||||
  set_fact:
 | 
			
		||||
    matrix_docker_image_postgres_to_use: "{{ matrix_docker_image_postgres_v9 }}"
 | 
			
		||||
    matrix_postgres_docker_image_to_use: "{{ matrix_postgres_docker_image_v9 }}"
 | 
			
		||||
  when: "pg_version.startswith('9.')"
 | 
			
		||||
 | 
			
		||||
- debug:
 | 
			
		||||
    msg: "NOTE: Your setup is on an old Postgres version ({{ matrix_docker_image_postgres_to_use }}), while {{ matrix_docker_image_postgres_latest }} is supported. You can upgrade using --tags=upgrade-postgres"
 | 
			
		||||
  when: "matrix_docker_image_postgres_to_use != matrix_docker_image_postgres_latest"
 | 
			
		||||
    msg: "NOTE: Your setup is on an old Postgres version ({{ matrix_postgres_docker_image_to_use }}), while {{ matrix_postgres_docker_image_latest }} is supported. You can upgrade using --tags=upgrade-postgres"
 | 
			
		||||
  when: "matrix_postgres_docker_image_to_use != matrix_postgres_docker_image_latest"
 | 
			
		||||
 | 
			
		||||
# Even if we don't run the internal server, we still need this for running the CLI
 | 
			
		||||
- name: Ensure postgres Docker image is pulled
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ matrix_docker_image_postgres_to_use }}"
 | 
			
		||||
    name: "{{ matrix_postgres_docker_image_to_use }}"
 | 
			
		||||
 | 
			
		||||
- name: Ensure Postgres environment variables file created
 | 
			
		||||
  template:
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure riot-web Docker image is pulled
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ matrix_docker_image_riot }}"
 | 
			
		||||
    name: "{{ matrix_riot_web_docker_image }}"
 | 
			
		||||
  when: matrix_riot_web_enabled
 | 
			
		||||
 | 
			
		||||
- name: Ensure Matrix riot-web configured
 | 
			
		||||
@@ -64,6 +64,6 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure riot-web Docker image doesn't exist
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ matrix_docker_image_riot }}"
 | 
			
		||||
    name: "{{ matrix_riot_web_docker_image }}"
 | 
			
		||||
    state: absent
 | 
			
		||||
  when: "not matrix_riot_web_enabled"
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure Mautrix Telegram image is pulled
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ matrix_docker_image_mautrix_telegram }}"
 | 
			
		||||
    name: "{{ matrix_mautrix_telegram_docker_image }}"
 | 
			
		||||
  when: "matrix_mautrix_telegram_enabled"
 | 
			
		||||
 | 
			
		||||
- name: Ensure Mautrix Telegram configuration path exists
 | 
			
		||||
@@ -37,7 +37,7 @@
 | 
			
		||||
  register: mautrix_telegram_registration_file
 | 
			
		||||
 | 
			
		||||
- name: Generate matrix-mautrix-telegram registration.yaml if it doesn't exist
 | 
			
		||||
  shell: /usr/bin/docker run --rm --name matrix-mautrix-telegram-gen -v {{ matrix_mautrix_telegram_base_path }}:/data:z {{ matrix_docker_image_mautrix_telegram }} python3 -m mautrix_telegram -g -c /data/config.yaml -r /data/registration.yaml
 | 
			
		||||
  shell: /usr/bin/docker run --rm --name matrix-mautrix-telegram-gen -v {{ matrix_mautrix_telegram_base_path }}:/data:z {{ matrix_mautrix_telegram_docker_image }} python3 -m mautrix_telegram -g -c /data/config.yaml -r /data/registration.yaml
 | 
			
		||||
  when: "matrix_mautrix_telegram_enabled and mautrix_telegram_registration_file.stat.exists == False"
 | 
			
		||||
 | 
			
		||||
- set_fact:
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure Mautrix Whatsapp image is pulled
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ matrix_docker_image_mautrix_whatsapp }}"
 | 
			
		||||
    name: "{{ matrix_mautrix_whatsapp_docker_image }}"
 | 
			
		||||
  when: "matrix_mautrix_whatsapp_enabled"
 | 
			
		||||
 | 
			
		||||
- name: Ensure Mautrix Whatsapp configuration path exists
 | 
			
		||||
@@ -37,7 +37,7 @@
 | 
			
		||||
  register: mautrix_whatsapp_registration_file
 | 
			
		||||
 | 
			
		||||
- name: Generate matrix-mautrix-whatsapp registration.yaml if it doesn't exist
 | 
			
		||||
  shell: /usr/bin/docker run --rm --name matrix-mautrix-whatsapp-gen -v {{ matrix_mautrix_whatsapp_base_path }}:/data:z {{ matrix_docker_image_mautrix_whatsapp }} /usr/bin/mautrix-whatsapp -g -c /data/config.yaml -r /data/registration.yaml
 | 
			
		||||
  shell: /usr/bin/docker run --rm --name matrix-mautrix-whatsapp-gen -v {{ matrix_mautrix_whatsapp_base_path }}:/data:z {{ matrix_mautrix_whatsapp_docker_image }} /usr/bin/mautrix-whatsapp -g -c /data/config.yaml -r /data/registration.yaml
 | 
			
		||||
  when: "matrix_mautrix_whatsapp_enabled and mautrix_whatsapp_registration_file.stat.exists == False"
 | 
			
		||||
 | 
			
		||||
- set_fact:
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure Matrix Docker image is pulled
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ matrix_docker_image_synapse }}"
 | 
			
		||||
    name: "{{ matrix_synapse_docker_image }}"
 | 
			
		||||
 | 
			
		||||
- name: Check if a Matrix Synapse configuration exists
 | 
			
		||||
  stat:
 | 
			
		||||
@@ -36,7 +36,7 @@
 | 
			
		||||
- name: Generate initial Matrix config
 | 
			
		||||
  docker_container:
 | 
			
		||||
    name: matrix-config
 | 
			
		||||
    image: "{{ matrix_docker_image_synapse }}"
 | 
			
		||||
    image: "{{ matrix_synapse_docker_image }}"
 | 
			
		||||
    detach: no
 | 
			
		||||
    cleanup: yes
 | 
			
		||||
    command: generate
 | 
			
		||||
 
 | 
			
		||||
@@ -52,16 +52,16 @@
 | 
			
		||||
 | 
			
		||||
- name: Determine Postgres version to use (default to latest)
 | 
			
		||||
  set_fact:
 | 
			
		||||
    matrix_docker_image_postgres_to_use: "{{ matrix_docker_image_postgres_latest }}"
 | 
			
		||||
    matrix_postgres_docker_image_to_use: "{{ matrix_postgres_docker_image_latest }}"
 | 
			
		||||
 | 
			
		||||
- name: Determine Postgres version to use (use 9.x, if detected)
 | 
			
		||||
  set_fact:
 | 
			
		||||
    matrix_docker_image_postgres_to_use: "{{ matrix_docker_image_postgres_v9 }}"
 | 
			
		||||
    matrix_postgres_docker_image_to_use: "{{ matrix_postgres_docker_image_v9 }}"
 | 
			
		||||
  when: "pg_version.startswith('9.')"
 | 
			
		||||
 | 
			
		||||
- name: Abort, if already at latest Postgres version
 | 
			
		||||
  fail: msg="You are already running the latest Postgres version supported. Nothing to do"
 | 
			
		||||
  when: "matrix_docker_image_postgres_to_use == matrix_docker_image_postgres_latest"
 | 
			
		||||
  when: "matrix_postgres_docker_image_to_use == matrix_postgres_docker_image_latest"
 | 
			
		||||
 | 
			
		||||
- name: Ensure matrix-synapse is stopped
 | 
			
		||||
  service: name=matrix-synapse state=stopped
 | 
			
		||||
@@ -81,7 +81,7 @@
 | 
			
		||||
    --link matrix-postgres:postgres \
 | 
			
		||||
    --env-file={{ matrix_environment_variables_data_path }}/env-postgres-pgsql-docker \
 | 
			
		||||
    -v {{ postgres_dump_dir }}:/out \
 | 
			
		||||
    {{ matrix_docker_image_postgres_to_use }} pg_dump -h postgres {{ matrix_postgres_db_name }} -f /out/{{ postgres_dump_name }}
 | 
			
		||||
    {{ matrix_postgres_docker_image_to_use }} pg_dump -h postgres {{ matrix_postgres_db_name }} -f /out/{{ postgres_dump_name }}
 | 
			
		||||
 | 
			
		||||
- name: Ensure matrix-postgres is stopped
 | 
			
		||||
  service: name=matrix-postgres state=stopped
 | 
			
		||||
@@ -109,7 +109,7 @@
 | 
			
		||||
    --link matrix-postgres:postgres \
 | 
			
		||||
    --env-file={{ matrix_environment_variables_data_path }}/env-postgres-pgsql-docker \
 | 
			
		||||
    -v {{ postgres_dump_dir }}:/in:ro \
 | 
			
		||||
    {{ matrix_docker_image_postgres_latest }} psql -h postgres -f /in/{{ postgres_dump_name }}
 | 
			
		||||
    {{ matrix_postgres_docker_image_latest }} psql -h postgres -f /in/{{ postgres_dump_name }}
 | 
			
		||||
 | 
			
		||||
- name: Delete Postgres database dump file
 | 
			
		||||
  file:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user