Use fully-qualified module names for builtin Ansible modules

Related to https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/1939
This commit is contained in:
Slavi Pantaleev 2022-07-18 10:39:08 +03:00
parent 78b5be4a26
commit 34cdaade08
297 changed files with 1420 additions and 1420 deletions

View File

@ -1,7 +1,7 @@
--- ---
- name: Ensure AUX directories are created - name: Ensure AUX directories are created
file: ansible.builtin.file:
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
state: directory state: directory
owner: "{{ item.owner|default(matrix_user_username) }}" owner: "{{ item.owner|default(matrix_user_username) }}"
@ -10,7 +10,7 @@
with_items: "{{ matrix_aux_directory_definitions }}" with_items: "{{ matrix_aux_directory_definitions }}"
- name: Ensure AUX files are created - name: Ensure AUX files are created
copy: ansible.builtin.copy:
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
content: "{{ item.content }}" content: "{{ item.content }}"
owner: "{{ item.owner|default(matrix_user_username) }}" owner: "{{ item.owner|default(matrix_user_username) }}"

View File

@ -1,4 +1,4 @@
--- ---
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-backup-borg.timer'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-backup-borg.timer'] }}"
when: matrix_backup_borg_enabled|bool when: matrix_backup_borg_enabled|bool

View File

@ -3,17 +3,17 @@
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/detect_existing_postgres_version.yml" - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/detect_existing_postgres_version.yml"
- name: Fail if detected Postgres version is unsupported - name: Fail if detected Postgres version is unsupported
fail: ansible.builtin.fail:
msg: "You cannot use borg backup with such an old version ({{ matrix_postgres_detected_version }}) of Postgres. Consider upgrading - link to docs for upgrading Postgres: docs/maintenance-postgres.md#upgrading-postgresql" msg: "You cannot use borg backup with such an old version ({{ matrix_postgres_detected_version }}) of Postgres. Consider upgrading - link to docs for upgrading Postgres: docs/maintenance-postgres.md#upgrading-postgresql"
when: "matrix_postgres_detected_version not in matrix_backup_borg_supported_postgres_versions" when: "matrix_postgres_detected_version not in matrix_backup_borg_supported_postgres_versions"
- name: Set the correct borg backup version to use - name: Set the correct borg backup version to use
set_fact: ansible.builtin.set_fact:
matrix_backup_borg_version: "{{ matrix_postgres_detected_version }}" matrix_backup_borg_version: "{{ matrix_postgres_detected_version }}"
when: matrix_backup_borg_postgresql_enabled|bool and matrix_backup_borg_version == '' when: matrix_backup_borg_postgresql_enabled|bool and matrix_backup_borg_version == ''
- name: Ensure borg paths exist - name: Ensure borg paths exist
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -25,7 +25,7 @@
when: "item.when|bool" when: "item.when|bool"
- name: Ensure borgmatic config is created - name: Ensure borgmatic config is created
copy: ansible.builtin.copy:
content: "{{ matrix_backup_borg_configuration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_backup_borg_configuration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_backup_borg_config_path }}/config.yaml" dest: "{{ matrix_backup_borg_config_path }}/config.yaml"
owner: "{{ matrix_user_username }}" owner: "{{ matrix_user_username }}"
@ -33,7 +33,7 @@
mode: 0640 mode: 0640
- name: Ensure borg passwd is created - name: Ensure borg passwd is created
template: ansible.builtin.template:
src: "{{ role_path }}/templates/passwd.j2" src: "{{ role_path }}/templates/passwd.j2"
dest: "{{ matrix_backup_borg_config_path }}/passwd" dest: "{{ matrix_backup_borg_config_path }}/passwd"
owner: "{{ matrix_user_username }}" owner: "{{ matrix_user_username }}"
@ -41,7 +41,7 @@
mode: 0640 mode: 0640
- name: Ensure borg ssh key is created - name: Ensure borg ssh key is created
template: ansible.builtin.template:
src: "{{ role_path }}/templates/sshkey.j2" src: "{{ role_path }}/templates/sshkey.j2"
dest: "{{ matrix_backup_borg_config_path }}/sshkey" dest: "{{ matrix_backup_borg_config_path }}/sshkey"
owner: "{{ matrix_user_username }}" owner: "{{ matrix_user_username }}"
@ -61,7 +61,7 @@
until: result is not failed until: result is not failed
- name: Ensure borg repository is present on self-build - name: Ensure borg repository is present on self-build
git: ansible.builtin.git:
repo: "{{ matrix_backup_borg_docker_repo }}" repo: "{{ matrix_backup_borg_docker_repo }}"
dest: "{{ matrix_backup_borg_docker_src_files_path }}" dest: "{{ matrix_backup_borg_docker_src_files_path }}"
force: "yes" force: "yes"
@ -83,30 +83,30 @@
when: "matrix_backup_borg_container_image_self_build|bool" when: "matrix_backup_borg_container_image_self_build|bool"
- name: Ensure matrix-backup-borg.service installed - name: Ensure matrix-backup-borg.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-backup-borg.service.j2" src: "{{ role_path }}/templates/systemd/matrix-backup-borg.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-backup-borg.service" dest: "{{ matrix_systemd_path }}/matrix-backup-borg.service"
mode: 0644 mode: 0644
register: matrix_backup_borg_systemd_service_result register: matrix_backup_borg_systemd_service_result
- name: Ensure matrix-backup-borg.timer installed - name: Ensure matrix-backup-borg.timer installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-backup-borg.timer.j2" src: "{{ role_path }}/templates/systemd/matrix-backup-borg.timer.j2"
dest: "{{ matrix_systemd_path }}/matrix-backup-borg.timer" dest: "{{ matrix_systemd_path }}/matrix-backup-borg.timer"
mode: 0644 mode: 0644
register: matrix_backup_borg_systemd_timer_result register: matrix_backup_borg_systemd_timer_result
- name: Ensure systemd reloaded after matrix-backup-borg.service installation - name: Ensure systemd reloaded after matrix-backup-borg.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_backup_borg_systemd_service_result.changed|bool" when: "matrix_backup_borg_systemd_service_result.changed|bool"
- name: Ensure matrix-backup-borg.service enabled - name: Ensure matrix-backup-borg.service enabled
service: ansible.builtin.service:
enabled: true enabled: true
name: matrix-backup-borg.service name: matrix-backup-borg.service
- name: Ensure matrix-backup-borg.timer enabled - name: Ensure matrix-backup-borg.timer enabled
service: ansible.builtin.service:
enabled: true enabled: true
name: matrix-backup-borg.timer name: matrix-backup-borg.timer

View File

@ -5,7 +5,7 @@
register: matrix_backup_borg_service_stat register: matrix_backup_borg_service_stat
- name: Ensure matrix-backup-borg is stopped - name: Ensure matrix-backup-borg is stopped
service: ansible.builtin.service:
name: matrix-backup-borg name: matrix-backup-borg
state: stopped state: stopped
enabled: false enabled: false
@ -14,24 +14,24 @@
when: "matrix_backup_borg_service_stat.stat.exists|bool" when: "matrix_backup_borg_service_stat.stat.exists|bool"
- name: Ensure matrix-backup-borg.service doesn't exist - name: Ensure matrix-backup-borg.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-backup-borg.service" path: "{{ matrix_systemd_path }}/matrix-backup-borg.service"
state: absent state: absent
when: "matrix_backup_borg_service_stat.stat.exists|bool" when: "matrix_backup_borg_service_stat.stat.exists|bool"
- name: Ensure matrix-backup-borg.timer doesn't exist - name: Ensure matrix-backup-borg.timer doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-backup-borg.timer" path: "{{ matrix_systemd_path }}/matrix-backup-borg.timer"
state: absent state: absent
when: "matrix_backup_borg_service_stat.stat.exists|bool" when: "matrix_backup_borg_service_stat.stat.exists|bool"
- name: Ensure systemd reloaded after matrix-backup-borg.service removal - name: Ensure systemd reloaded after matrix-backup-borg.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_backup_borg_service_stat.stat.exists|bool" when: "matrix_backup_borg_service_stat.stat.exists|bool"
- name: Ensure Matrix borg paths don't exist - name: Ensure Matrix borg paths don't exist
file: ansible.builtin.file:
path: "{{ matrix_backup_borg_base_path }}" path: "{{ matrix_backup_borg_base_path }}"
state: absent state: absent

View File

@ -1,6 +1,6 @@
--- ---
- name: Fail if required settings not defined - name: Fail if required settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"
@ -9,7 +9,7 @@
- "matrix_backup_borg_location_repositories" - "matrix_backup_borg_location_repositories"
- name: Fail if encryption passphrase is undefined unless repository is unencrypted - name: Fail if encryption passphrase is undefined unless repository is unencrypted
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required passphrase using the `matrix_backup_borg_storage_encryption_passphrase` variable. You need to define a required passphrase using the `matrix_backup_borg_storage_encryption_passphrase` variable.
when: "matrix_backup_borg_storage_encryption_passphrase == '' and matrix_backup_borg_encryption != 'none'" when: "matrix_backup_borg_storage_encryption_passphrase == '' and matrix_backup_borg_encryption != 'none'"

View File

@ -1,7 +1,7 @@
--- ---
- name: Get rid of old files and directories - name: Get rid of old files and directories
file: ansible.builtin.file:
path: "{{ item }}" path: "{{ item }}"
state: absent state: absent
with_items: with_items:

View File

@ -1,27 +1,27 @@
--- ---
- name: Fail if invalid homeserver implementation - name: Fail if invalid homeserver implementation
fail: ansible.builtin.fail:
msg: "You need to set a valid homeserver implementation in `matrix_homeserver_implementation`" msg: "You need to set a valid homeserver implementation in `matrix_homeserver_implementation`"
when: "matrix_homeserver_implementation not in ['synapse', 'dendrite']" when: "matrix_homeserver_implementation not in ['synapse', 'dendrite']"
# We generally support Ansible 2.7.1 and above. # We generally support Ansible 2.7.1 and above.
- name: Fail if running on Ansible < 2.7.1 - name: Fail if running on Ansible < 2.7.1
fail: ansible.builtin.fail:
msg: "You are running on Ansible {{ ansible_version.string }}, which is not supported. See our guide about Ansible: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/ansible.md" msg: "You are running on Ansible {{ ansible_version.string }}, which is not supported. See our guide about Ansible: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/ansible.md"
when: when:
- "(ansible_version.major < 2) or (ansible_version.major == 2 and ansible_version.minor < 7) or (ansible_version.major == 2 and ansible_version.minor == 7 and ansible_version.revision < 1)" - "(ansible_version.major < 2) or (ansible_version.major == 2 and ansible_version.minor < 7) or (ansible_version.major == 2 and ansible_version.minor == 7 and ansible_version.revision < 1)"
# Though we do not support Ansible 2.9.6 which is buggy # Though we do not support Ansible 2.9.6 which is buggy
- name: Fail if running on Ansible 2.9.6 on Ubuntu - name: Fail if running on Ansible 2.9.6 on Ubuntu
fail: ansible.builtin.fail:
msg: "You are running on Ansible {{ ansible_version.string }}, which is not supported. See our guide about Ansible: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/ansible.md" msg: "You are running on Ansible {{ ansible_version.string }}, which is not supported. See our guide about Ansible: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/ansible.md"
when: when:
- ansible_distribution == 'Ubuntu' - ansible_distribution == 'Ubuntu'
- "ansible_version.major == 2 and ansible_version.minor == 9 and ansible_version.revision == 6" - "ansible_version.major == 2 and ansible_version.minor == 9 and ansible_version.revision == 6"
- name: (Deprecation) Catch and report renamed settings - name: (Deprecation) Catch and report renamed settings
fail: ansible.builtin.fail:
msg: >- msg: >-
Your configuration contains a variable, which now has a different name. Your configuration contains a variable, which now has a different name.
Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
@ -35,7 +35,7 @@
# We have a dedicated check for this variable, because we'd like to have a custom (friendlier) message. # We have a dedicated check for this variable, because we'd like to have a custom (friendlier) message.
- name: Fail if matrix_homeserver_generic_secret_key is undefined - name: Fail if matrix_homeserver_generic_secret_key is undefined
fail: ansible.builtin.fail:
msg: | msg: |
The `matrix_homeserver_generic_secret_key` variable must be defined and have a non-null and non-empty value. The `matrix_homeserver_generic_secret_key` variable must be defined and have a non-null and non-empty value.
@ -47,7 +47,7 @@
when: "matrix_homeserver_generic_secret_key is none or matrix_homeserver_generic_secret_key == ''" when: "matrix_homeserver_generic_secret_key is none or matrix_homeserver_generic_secret_key == ''"
- name: Fail if required variables are undefined - name: Fail if required variables are undefined
fail: ansible.builtin.fail:
msg: "The `{{ item.var }}` variable must be defined and have a non-null and non-empty value" msg: "The `{{ item.var }}` variable must be defined and have a non-null and non-empty value"
with_items: with_items:
- {'var': matrix_domain, 'value': "{{ matrix_domain|default('') }}"} - {'var': matrix_domain, 'value': "{{ matrix_domain|default('') }}"}
@ -58,7 +58,7 @@
when: "item.value is none or item.value == ''" when: "item.value is none or item.value == ''"
- name: Fail if uppercase domain used - name: Fail if uppercase domain used
fail: ansible.builtin.fail:
msg: "Detected that you're using an uppercase domain name - `{{ item }}`. This will cause trouble. Please use all-lowercase!" msg: "Detected that you're using an uppercase domain name - `{{ item }}`. This will cause trouble. Please use all-lowercase!"
with_items: with_items:
- "{{ matrix_domain }}" - "{{ matrix_domain }}"
@ -67,21 +67,21 @@
when: "item != item|lower" when: "item != item|lower"
- name: Fail if using python2 on Archlinux - name: Fail if using python2 on Archlinux
fail: ansible.builtin.fail:
msg: "Detected that you're using python2 when installing onto Archlinux. Archlinux by default only supports python3." msg: "Detected that you're using python2 when installing onto Archlinux. Archlinux by default only supports python3."
when: when:
- ansible_distribution == 'Archlinux' - ansible_distribution == 'Archlinux'
- ansible_python.version.major != 3 - ansible_python.version.major != 3
- name: Fail if architecture is set incorrectly - name: Fail if architecture is set incorrectly
fail: ansible.builtin.fail:
msg: "Detected that variable matrix_architecture {{ matrix_architecture }} appears to be set incorrectly. See docs/alternative-architectures.md. Server appears to be {{ ansible_architecture }}." msg: "Detected that variable matrix_architecture {{ matrix_architecture }} appears to be set incorrectly. See docs/alternative-architectures.md. Server appears to be {{ ansible_architecture }}."
when: (ansible_architecture == "x86_64" and matrix_architecture != "amd64") or when: (ansible_architecture == "x86_64" and matrix_architecture != "amd64") or
(ansible_architecture == "aarch64" and matrix_architecture != "arm64") or (ansible_architecture == "aarch64" and matrix_architecture != "arm64") or
(ansible_architecture.startswith("armv") and matrix_architecture != "arm32") (ansible_architecture.startswith("armv") and matrix_architecture != "arm32")
- name: Fail if encountering usage of removed role (mx-puppet-skype) - name: Fail if encountering usage of removed role (mx-puppet-skype)
fail: ansible.builtin.fail:
msg: >- msg: >-
Your configuration seems to include a reference to `matrix_mx_puppet_skype_enabled`. Are you trying to install the mx-puppet-skype bridge? Your configuration seems to include a reference to `matrix_mx_puppet_skype_enabled`. Are you trying to install the mx-puppet-skype bridge?
The playbook no longer includes a role for installing mx-puppet-skype, because the mx-puppet-bridge is unmaintained and has been reported as broken for a long time. The playbook no longer includes a role for installing mx-puppet-skype, because the mx-puppet-bridge is unmaintained and has been reported as broken for a long time.

View File

@ -12,7 +12,7 @@
- block: - block:
# ansible_lsb is only available if lsb-release is installed. # ansible_lsb is only available if lsb-release is installed.
- name: Ensure lsb-release installed - name: Ensure lsb-release installed
apt: ansible.builtin.apt:
name: name:
- lsb-release - lsb-release
state: present state: present
@ -34,13 +34,13 @@
when: ansible_distribution == 'Archlinux' when: ansible_distribution == 'Archlinux'
- name: Ensure Docker is started and autoruns - name: Ensure Docker is started and autoruns
service: ansible.builtin.service:
name: docker name: docker
state: started state: started
enabled: true enabled: true
- name: "Ensure {{ matrix_ntpd_service }} is started and autoruns" - name: "Ensure {{ matrix_ntpd_service }} is started and autoruns"
service: ansible.builtin.service:
name: "{{ matrix_ntpd_service }}" name: "{{ matrix_ntpd_service }}"
state: started state: started
enabled: true enabled: true

View File

@ -1,7 +1,7 @@
--- ---
- name: Ensure APT usage dependencies are installed - name: Ensure APT usage dependencies are installed
apt: ansible.builtin.apt:
name: name:
- apt-transport-https - apt-transport-https
- ca-certificates - ca-certificates
@ -26,14 +26,14 @@
when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure APT packages are installed - name: Ensure APT packages are installed
apt: ansible.builtin.apt:
name: name:
- "{{ matrix_ntpd_package }}" - "{{ matrix_ntpd_package }}"
state: latest state: latest
update_cache: true update_cache: true
- name: Ensure Docker is installed - name: Ensure Docker is installed
apt: ansible.builtin.apt:
name: name:
- "{{ matrix_docker_package_name }}" - "{{ matrix_docker_package_name }}"
- "python{{'3' if ansible_python.version.major == 3 else ''}}-docker" - "python{{'3' if ansible_python.version.major == 3 else ''}}-docker"

View File

@ -1,7 +1,7 @@
--- ---
- name: Ensure Docker repository is enabled - name: Ensure Docker repository is enabled
template: ansible.builtin.template:
src: "{{ role_path }}/files/yum.repos.d/{{ item }}" src: "{{ role_path }}/files/yum.repos.d/{{ item }}"
dest: "/etc/yum.repos.d/docker-ce.repo" dest: "/etc/yum.repos.d/docker-ce.repo"
owner: "root" owner: "root"
@ -18,14 +18,14 @@
when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure yum packages are installed - name: Ensure yum packages are installed
yum: ansible.builtin.yum:
name: name:
- "{{ matrix_ntpd_package }}" - "{{ matrix_ntpd_package }}"
state: latest state: latest
update_cache: true update_cache: true
- name: Ensure Docker is installed - name: Ensure Docker is installed
yum: ansible.builtin.yum:
name: name:
- "{{ matrix_docker_package_name }}" - "{{ matrix_docker_package_name }}"
- python3-pip - python3-pip

View File

@ -1,7 +1,7 @@
--- ---
- name: Ensure APT usage dependencies are installed - name: Ensure APT usage dependencies are installed
apt: ansible.builtin.apt:
name: name:
- apt-transport-https - apt-transport-https
- ca-certificates - ca-certificates
@ -26,14 +26,14 @@
when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure APT packages are installed - name: Ensure APT packages are installed
apt: ansible.builtin.apt:
name: name:
- "{{ matrix_ntpd_package }}" - "{{ matrix_ntpd_package }}"
state: latest state: latest
update_cache: true update_cache: true
- name: Ensure Docker is installed - name: Ensure Docker is installed
apt: ansible.builtin.apt:
name: name:
- "{{ matrix_docker_package_name }}" - "{{ matrix_docker_package_name }}"
- "python{{'3' if ansible_python.version.major == 3 else ''}}-docker" - "python{{'3' if ansible_python.version.major == 3 else ''}}-docker"

View File

@ -1,7 +1,7 @@
--- ---
- name: Ensure Docker repository is enabled - name: Ensure Docker repository is enabled
template: ansible.builtin.template:
src: "{{ role_path }}/files/yum.repos.d/docker-ce-centos.repo" src: "{{ role_path }}/files/yum.repos.d/docker-ce-centos.repo"
dest: "/etc/yum.repos.d/docker-ce.repo" dest: "/etc/yum.repos.d/docker-ce.repo"
owner: "root" owner: "root"
@ -16,14 +16,14 @@
when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure yum packages are installed - name: Ensure yum packages are installed
yum: ansible.builtin.yum:
name: name:
- "{{ matrix_ntpd_package }}" - "{{ matrix_ntpd_package }}"
state: latest state: latest
update_cache: true update_cache: true
- name: Ensure Docker is installed - name: Ensure Docker is installed
yum: ansible.builtin.yum:
name: name:
- "{{ matrix_docker_package_name }}" - "{{ matrix_docker_package_name }}"
- docker-python - docker-python

View File

@ -1,7 +1,7 @@
--- ---
- name: Ensure Docker repository is enabled - name: Ensure Docker repository is enabled
template: ansible.builtin.template:
src: "{{ role_path }}/files/yum.repos.d/docker-ce-centos.repo" src: "{{ role_path }}/files/yum.repos.d/docker-ce-centos.repo"
dest: "/etc/yum.repos.d/docker-ce.repo" dest: "/etc/yum.repos.d/docker-ce.repo"
owner: "root" owner: "root"
@ -16,21 +16,21 @@
when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure EPEL is installed - name: Ensure EPEL is installed
yum: ansible.builtin.yum:
name: name:
- epel-release - epel-release
state: latest state: latest
update_cache: true update_cache: true
- name: Ensure yum packages are installed - name: Ensure yum packages are installed
yum: ansible.builtin.yum:
name: name:
- "{{ matrix_ntpd_package }}" - "{{ matrix_ntpd_package }}"
state: latest state: latest
update_cache: true update_cache: true
- name: Ensure Docker is installed - name: Ensure Docker is installed
yum: ansible.builtin.yum:
name: name:
- "{{ matrix_docker_package_name }}" - "{{ matrix_docker_package_name }}"
- python3-pip - python3-pip

View File

@ -1,7 +1,7 @@
--- ---
- name: Ensure Matrix base path exists - name: Ensure Matrix base path exists
file: ansible.builtin.file:
path: "{{ item }}" path: "{{ item }}"
state: directory state: directory
mode: "{{ matrix_base_data_path_mode }}" mode: "{{ matrix_base_data_path_mode }}"
@ -11,7 +11,7 @@
- "{{ matrix_base_data_path }}" - "{{ matrix_base_data_path }}"
- name: Preserve vars.yml on the server for easily restoring if it gets lost later on - name: Preserve vars.yml on the server for easily restoring if it gets lost later on
copy: ansible.builtin.copy:
src: "{{ matrix_vars_yml_snapshotting_src }}" src: "{{ matrix_vars_yml_snapshotting_src }}"
dest: "{{ matrix_base_data_path }}/vars.yml" dest: "{{ matrix_base_data_path }}/vars.yml"
owner: "{{ matrix_user_username }}" owner: "{{ matrix_user_username }}"
@ -25,7 +25,7 @@
driver: bridge driver: bridge
- name: Ensure matrix-remove-all script created - name: Ensure matrix-remove-all script created
template: ansible.builtin.template:
src: "{{ role_path }}/templates/usr-local-bin/matrix-remove-all.j2" src: "{{ role_path }}/templates/usr-local-bin/matrix-remove-all.j2"
dest: "{{ matrix_local_bin_path }}/matrix-remove-all" dest: "{{ matrix_local_bin_path }}/matrix-remove-all"
mode: 0750 mode: 0750

View File

@ -1,18 +1,18 @@
--- ---
- name: Ensure Matrix group is created - name: Ensure Matrix group is created
group: ansible.builtin.group:
name: "{{ matrix_user_groupname }}" name: "{{ matrix_user_groupname }}"
gid: "{{ omit if matrix_user_gid is none else matrix_user_gid }}" gid: "{{ omit if matrix_user_gid is none else matrix_user_gid }}"
state: present state: present
register: matrix_group register: matrix_group
- name: Set Matrix Group GID Variable - name: Set Matrix Group GID Variable
set_fact: ansible.builtin.set_fact:
matrix_user_gid: "{{ matrix_group.gid }}" matrix_user_gid: "{{ matrix_group.gid }}"
- name: Ensure Matrix user is created - name: Ensure Matrix user is created
user: ansible.builtin.user:
name: "{{ matrix_user_username }}" name: "{{ matrix_user_username }}"
uid: "{{ omit if matrix_user_uid is none else matrix_user_uid }}" uid: "{{ omit if matrix_user_uid is none else matrix_user_uid }}"
state: present state: present
@ -23,5 +23,5 @@
register: matrix_user register: matrix_user
- name: Set Matrix Group UID Variable - name: Set Matrix Group UID Variable
set_fact: ansible.builtin.set_fact:
matrix_user_uid: "{{ matrix_user.uid }}" matrix_user_uid: "{{ matrix_user.uid }}"

View File

@ -4,7 +4,7 @@
# #
# For running with another webserver, we recommend being part of the `matrix` group. # For running with another webserver, we recommend being part of the `matrix` group.
- name: Ensure Matrix static-files path exists - name: Ensure Matrix static-files path exists
file: ansible.builtin.file:
path: "{{ item }}" path: "{{ item }}"
state: directory state: directory
mode: 0755 mode: 0755
@ -14,7 +14,7 @@
- "{{ matrix_static_files_base_path }}/.well-known/matrix" - "{{ matrix_static_files_base_path }}/.well-known/matrix"
- name: Ensure Matrix /.well-known/matrix/client file configured - name: Ensure Matrix /.well-known/matrix/client file configured
copy: ansible.builtin.copy:
content: "{{ matrix_well_known_matrix_client_configuration|to_nice_json }}" content: "{{ matrix_well_known_matrix_client_configuration|to_nice_json }}"
dest: "{{ matrix_static_files_base_path }}/.well-known/matrix/client" dest: "{{ matrix_static_files_base_path }}/.well-known/matrix/client"
mode: 0644 mode: 0644
@ -22,7 +22,7 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure Matrix /.well-known/matrix/server file configured - name: Ensure Matrix /.well-known/matrix/server file configured
copy: ansible.builtin.copy:
content: "{{ matrix_well_known_matrix_server_configuration|to_nice_json }}" content: "{{ matrix_well_known_matrix_server_configuration|to_nice_json }}"
dest: "{{ matrix_static_files_base_path }}/.well-known/matrix/server" dest: "{{ matrix_static_files_base_path }}/.well-known/matrix/server"
mode: 0644 mode: 0644
@ -31,7 +31,7 @@
when: matrix_well_known_matrix_server_enabled|bool when: matrix_well_known_matrix_server_enabled|bool
- name: Ensure Matrix /.well-known/matrix/server file deleted - name: Ensure Matrix /.well-known/matrix/server file deleted
file: ansible.builtin.file:
path: "{{ matrix_static_files_base_path }}/.well-known/matrix/server" path: "{{ matrix_static_files_base_path }}/.well-known/matrix/server"
state: absent state: absent
when: "not matrix_well_known_matrix_server_enabled|bool" when: "not matrix_well_known_matrix_server_enabled|bool"

View File

@ -1,7 +1,7 @@
--- ---
# This is for both RedHat 7 and 8 # This is for both RedHat 7 and 8
- name: Ensure fuse installed (RedHat) - name: Ensure fuse installed (RedHat)
yum: ansible.builtin.yum:
name: name:
- fuse - fuse
state: latest state: latest
@ -9,7 +9,7 @@
# This is for both Debian and Raspbian # This is for both Debian and Raspbian
- name: Ensure fuse installed (Debian/Raspbian) - name: Ensure fuse installed (Debian/Raspbian)
apt: ansible.builtin.apt:
name: name:
- fuse - fuse
state: latest state: latest

View File

@ -1,7 +1,7 @@
--- ---
# This is for both RedHat 7 and 8 # This is for both RedHat 7 and 8
- name: Ensure openssl installed (RedHat) - name: Ensure openssl installed (RedHat)
yum: ansible.builtin.yum:
name: name:
- openssl - openssl
state: latest state: latest
@ -9,7 +9,7 @@
# This is for both Debian and Raspbian # This is for both Debian and Raspbian
- name: Ensure openssl installed (Debian/Raspbian) - name: Ensure openssl installed (Debian/Raspbian)
apt: ansible.builtin.apt:
name: name:
- openssl - openssl
state: latest state: latest

View File

@ -1,5 +1,5 @@
--- ---
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-buscarron.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-buscarron.service'] }}"
when: matrix_bot_buscarron_enabled|bool when: matrix_bot_buscarron_enabled|bool

View File

@ -1,5 +1,5 @@
--- ---
- set_fact: - ansible.builtin.set_fact:
matrix_bot_buscarron_requires_restart: false matrix_bot_buscarron_requires_restart: false
- block: - block:
@ -9,7 +9,7 @@
register: matrix_bot_buscarron_sqlite_database_path_local_stat_result register: matrix_bot_buscarron_sqlite_database_path_local_stat_result
- block: - block:
- set_fact: - ansible.builtin.set_fact:
matrix_postgres_db_migration_request: matrix_postgres_db_migration_request:
src: "{{ matrix_bot_buscarron_sqlite_database_path_local }}" src: "{{ matrix_bot_buscarron_sqlite_database_path_local }}"
dst: "{{ matrix_bot_buscarron_database_connection_string }}" dst: "{{ matrix_bot_buscarron_database_connection_string }}"
@ -20,13 +20,13 @@
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
- set_fact: - ansible.builtin.set_fact:
matrix_bot_buscarron_requires_restart: true matrix_bot_buscarron_requires_restart: true
when: "matrix_bot_buscarron_sqlite_database_path_local_stat_result.stat.exists|bool" when: "matrix_bot_buscarron_sqlite_database_path_local_stat_result.stat.exists|bool"
when: "matrix_bot_buscarron_database_engine == 'postgres'" when: "matrix_bot_buscarron_database_engine == 'postgres'"
- name: Ensure buscarron paths exist - name: Ensure buscarron paths exist
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -40,7 +40,7 @@
when: "item.when|bool" when: "item.when|bool"
- name: Ensure buscarron environment variables file created - name: Ensure buscarron environment variables file created
template: ansible.builtin.template:
src: "{{ role_path }}/templates/env.j2" src: "{{ role_path }}/templates/env.j2"
dest: "{{ matrix_bot_buscarron_config_path }}/env" dest: "{{ matrix_bot_buscarron_config_path }}/env"
owner: "{{ matrix_user_username }}" owner: "{{ matrix_user_username }}"
@ -60,7 +60,7 @@
until: result is not failed until: result is not failed
- name: Ensure buscarron repository is present on self-build - name: Ensure buscarron repository is present on self-build
git: ansible.builtin.git:
repo: "{{ matrix_bot_buscarron_docker_repo }}" repo: "{{ matrix_bot_buscarron_docker_repo }}"
dest: "{{ matrix_bot_buscarron_docker_src_files_path }}" dest: "{{ matrix_bot_buscarron_docker_src_files_path }}"
force: "yes" force: "yes"
@ -82,19 +82,19 @@
when: "matrix_bot_buscarron_container_image_self_build|bool" when: "matrix_bot_buscarron_container_image_self_build|bool"
- name: Ensure matrix-bot-buscarron.service installed - name: Ensure matrix-bot-buscarron.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-bot-buscarron.service.j2" src: "{{ role_path }}/templates/systemd/matrix-bot-buscarron.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-bot-buscarron.service" dest: "{{ matrix_systemd_path }}/matrix-bot-buscarron.service"
mode: 0644 mode: 0644
register: matrix_bot_buscarron_systemd_service_result register: matrix_bot_buscarron_systemd_service_result
- name: Ensure systemd reloaded after matrix-bot-buscarron.service installation - name: Ensure systemd reloaded after matrix-bot-buscarron.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_bot_buscarron_systemd_service_result.changed|bool" when: "matrix_bot_buscarron_systemd_service_result.changed|bool"
- name: Ensure matrix-bot-buscarron.service restarted, if necessary - name: Ensure matrix-bot-buscarron.service restarted, if necessary
service: ansible.builtin.service:
name: "matrix-bot-buscarron.service" name: "matrix-bot-buscarron.service"
state: restarted state: restarted
when: "matrix_bot_buscarron_requires_restart|bool" when: "matrix_bot_buscarron_requires_restart|bool"

View File

@ -6,7 +6,7 @@
register: matrix_bot_buscarron_service_stat register: matrix_bot_buscarron_service_stat
- name: Ensure matrix-buscarron is stopped - name: Ensure matrix-buscarron is stopped
service: ansible.builtin.service:
name: matrix-bot-buscarron name: matrix-bot-buscarron
state: stopped state: stopped
enabled: false enabled: false
@ -15,18 +15,18 @@
when: "matrix_bot_buscarron_service_stat.stat.exists|bool" when: "matrix_bot_buscarron_service_stat.stat.exists|bool"
- name: Ensure matrix-bot-buscarron.service doesn't exist - name: Ensure matrix-bot-buscarron.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-bot-buscarron.service" path: "{{ matrix_systemd_path }}/matrix-bot-buscarron.service"
state: absent state: absent
when: "matrix_bot_buscarron_service_stat.stat.exists|bool" when: "matrix_bot_buscarron_service_stat.stat.exists|bool"
- name: Ensure systemd reloaded after matrix-bot-buscarron.service removal - name: Ensure systemd reloaded after matrix-bot-buscarron.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_bot_buscarron_service_stat.stat.exists|bool" when: "matrix_bot_buscarron_service_stat.stat.exists|bool"
- name: Ensure Matrix buscarron paths don't exist - name: Ensure Matrix buscarron paths don't exist
file: ansible.builtin.file:
path: "{{ matrix_bot_buscarron_base_path }}" path: "{{ matrix_bot_buscarron_base_path }}"
state: absent state: absent

View File

@ -1,7 +1,7 @@
--- ---
- name: Fail if required settings not defined - name: Fail if required settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"

View File

@ -1,5 +1,5 @@
--- ---
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-go-neb.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-go-neb.service'] }}"
when: matrix_bot_go_neb_enabled|bool when: matrix_bot_go_neb_enabled|bool

View File

@ -1,10 +1,10 @@
--- ---
- set_fact: - ansible.builtin.set_fact:
matrix_bot_go_neb_requires_restart: false matrix_bot_go_neb_requires_restart: false
- name: Ensure go-neb paths exist - name: Ensure go-neb paths exist
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -28,7 +28,7 @@
until: result is not failed until: result is not failed
- name: Ensure go-neb config installed - name: Ensure go-neb config installed
copy: ansible.builtin.copy:
content: "{{ matrix_bot_go_neb_configuration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_bot_go_neb_configuration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_bot_go_neb_config_path }}/config.yaml" dest: "{{ matrix_bot_go_neb_config_path }}/config.yaml"
mode: 0644 mode: 0644
@ -36,19 +36,19 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-bot-go-neb.service installed - name: Ensure matrix-bot-go-neb.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-bot-go-neb.service.j2" src: "{{ role_path }}/templates/systemd/matrix-bot-go-neb.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-bot-go-neb.service" dest: "{{ matrix_systemd_path }}/matrix-bot-go-neb.service"
mode: 0644 mode: 0644
register: matrix_bot_go_neb_systemd_service_result register: matrix_bot_go_neb_systemd_service_result
- name: Ensure systemd reloaded after matrix-bot-go-neb.service installation - name: Ensure systemd reloaded after matrix-bot-go-neb.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_bot_go_neb_systemd_service_result.changed|bool" when: "matrix_bot_go_neb_systemd_service_result.changed|bool"
- name: Ensure matrix-bot-go-neb.service restarted, if necessary - name: Ensure matrix-bot-go-neb.service restarted, if necessary
service: ansible.builtin.service:
name: "matrix-bot-go-neb.service" name: "matrix-bot-go-neb.service"
state: restarted state: restarted
when: "matrix_bot_go_neb_requires_restart|bool" when: "matrix_bot_go_neb_requires_restart|bool"

View File

@ -6,7 +6,7 @@
register: matrix_bot_go_neb_service_stat register: matrix_bot_go_neb_service_stat
- name: Ensure matrix-go-neb is stopped - name: Ensure matrix-go-neb is stopped
service: ansible.builtin.service:
name: matrix-bot-go-neb name: matrix-bot-go-neb
state: stopped state: stopped
enabled: false enabled: false
@ -15,18 +15,18 @@
when: "matrix_bot_go_neb_service_stat.stat.exists|bool" when: "matrix_bot_go_neb_service_stat.stat.exists|bool"
- name: Ensure matrix-bot-go-neb.service doesn't exist - name: Ensure matrix-bot-go-neb.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-bot-go-neb.service" path: "{{ matrix_systemd_path }}/matrix-bot-go-neb.service"
state: absent state: absent
when: "matrix_bot_go_neb_service_stat.stat.exists|bool" when: "matrix_bot_go_neb_service_stat.stat.exists|bool"
- name: Ensure systemd reloaded after matrix-bot-go-neb.service removal - name: Ensure systemd reloaded after matrix-bot-go-neb.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_bot_go_neb_service_stat.stat.exists|bool" when: "matrix_bot_go_neb_service_stat.stat.exists|bool"
- name: Ensure Matrix go-neb paths don't exist - name: Ensure Matrix go-neb paths don't exist
file: ansible.builtin.file:
path: "{{ matrix_bot_go_neb_base_path }}" path: "{{ matrix_bot_go_neb_base_path }}"
state: absent state: absent

View File

@ -1,13 +1,13 @@
--- ---
- name: Fail if there's not at least 1 client - name: Fail if there's not at least 1 client
fail: ansible.builtin.fail:
msg: >- msg: >-
You need at least 1 client in the matrix_bot_go_neb_clients block. You need at least 1 client in the matrix_bot_go_neb_clients block.
when: matrix_bot_go_neb_clients is not defined or matrix_bot_go_neb_clients[0] is not defined when: matrix_bot_go_neb_clients is not defined or matrix_bot_go_neb_clients[0] is not defined
- name: Fail if there's not at least 1 service - name: Fail if there's not at least 1 service
fail: ansible.builtin.fail:
msg: >- msg: >-
You need at least 1 service in the matrix_bot_go_neb_services block. You need at least 1 service in the matrix_bot_go_neb_services block.
when: matrix_bot_go_neb_services is not defined or matrix_bot_go_neb_services[0] is not defined when: matrix_bot_go_neb_services is not defined or matrix_bot_go_neb_services[0] is not defined

View File

@ -1,5 +1,5 @@
--- ---
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-honoroit.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-honoroit.service'] }}"
when: matrix_bot_honoroit_enabled|bool when: matrix_bot_honoroit_enabled|bool

View File

@ -1,5 +1,5 @@
--- ---
- set_fact: - ansible.builtin.set_fact:
matrix_bot_honoroit_requires_restart: false matrix_bot_honoroit_requires_restart: false
- block: - block:
@ -9,7 +9,7 @@
register: matrix_bot_honoroit_sqlite_database_path_local_stat_result register: matrix_bot_honoroit_sqlite_database_path_local_stat_result
- block: - block:
- set_fact: - ansible.builtin.set_fact:
matrix_postgres_db_migration_request: matrix_postgres_db_migration_request:
src: "{{ matrix_bot_honoroit_sqlite_database_path_local }}" src: "{{ matrix_bot_honoroit_sqlite_database_path_local }}"
dst: "{{ matrix_bot_honoroit_database_connection_string }}" dst: "{{ matrix_bot_honoroit_database_connection_string }}"
@ -20,13 +20,13 @@
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
- set_fact: - ansible.builtin.set_fact:
matrix_bot_honoroit_requires_restart: true matrix_bot_honoroit_requires_restart: true
when: "matrix_bot_honoroit_sqlite_database_path_local_stat_result.stat.exists|bool" when: "matrix_bot_honoroit_sqlite_database_path_local_stat_result.stat.exists|bool"
when: "matrix_bot_honoroit_database_engine == 'postgres'" when: "matrix_bot_honoroit_database_engine == 'postgres'"
- name: Ensure honoroit paths exist - name: Ensure honoroit paths exist
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -40,7 +40,7 @@
when: "item.when|bool" when: "item.when|bool"
- name: Ensure honoroit environment variables file created - name: Ensure honoroit environment variables file created
template: ansible.builtin.template:
src: "{{ role_path }}/templates/env.j2" src: "{{ role_path }}/templates/env.j2"
dest: "{{ matrix_bot_honoroit_config_path }}/env" dest: "{{ matrix_bot_honoroit_config_path }}/env"
owner: "{{ matrix_user_username }}" owner: "{{ matrix_user_username }}"
@ -60,7 +60,7 @@
until: result is not failed until: result is not failed
- name: Ensure honoroit repository is present on self-build - name: Ensure honoroit repository is present on self-build
git: ansible.builtin.git:
repo: "{{ matrix_bot_honoroit_docker_repo }}" repo: "{{ matrix_bot_honoroit_docker_repo }}"
dest: "{{ matrix_bot_honoroit_docker_src_files_path }}" dest: "{{ matrix_bot_honoroit_docker_src_files_path }}"
force: "yes" force: "yes"
@ -82,19 +82,19 @@
when: "matrix_bot_honoroit_container_image_self_build|bool" when: "matrix_bot_honoroit_container_image_self_build|bool"
- name: Ensure matrix-bot-honoroit.service installed - name: Ensure matrix-bot-honoroit.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-bot-honoroit.service.j2" src: "{{ role_path }}/templates/systemd/matrix-bot-honoroit.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-bot-honoroit.service" dest: "{{ matrix_systemd_path }}/matrix-bot-honoroit.service"
mode: 0644 mode: 0644
register: matrix_bot_honoroit_systemd_service_result register: matrix_bot_honoroit_systemd_service_result
- name: Ensure systemd reloaded after matrix-bot-honoroit.service installation - name: Ensure systemd reloaded after matrix-bot-honoroit.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_bot_honoroit_systemd_service_result.changed|bool" when: "matrix_bot_honoroit_systemd_service_result.changed|bool"
- name: Ensure matrix-bot-honoroit.service restarted, if necessary - name: Ensure matrix-bot-honoroit.service restarted, if necessary
service: ansible.builtin.service:
name: "matrix-bot-honoroit.service" name: "matrix-bot-honoroit.service"
state: restarted state: restarted
when: "matrix_bot_honoroit_requires_restart|bool" when: "matrix_bot_honoroit_requires_restart|bool"

View File

@ -6,7 +6,7 @@
register: matrix_bot_honoroit_service_stat register: matrix_bot_honoroit_service_stat
- name: Ensure matrix-honoroit is stopped - name: Ensure matrix-honoroit is stopped
service: ansible.builtin.service:
name: matrix-bot-honoroit name: matrix-bot-honoroit
state: stopped state: stopped
enabled: false enabled: false
@ -15,18 +15,18 @@
when: "matrix_bot_honoroit_service_stat.stat.exists|bool" when: "matrix_bot_honoroit_service_stat.stat.exists|bool"
- name: Ensure matrix-bot-honoroit.service doesn't exist - name: Ensure matrix-bot-honoroit.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-bot-honoroit.service" path: "{{ matrix_systemd_path }}/matrix-bot-honoroit.service"
state: absent state: absent
when: "matrix_bot_honoroit_service_stat.stat.exists|bool" when: "matrix_bot_honoroit_service_stat.stat.exists|bool"
- name: Ensure systemd reloaded after matrix-bot-honoroit.service removal - name: Ensure systemd reloaded after matrix-bot-honoroit.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_bot_honoroit_service_stat.stat.exists|bool" when: "matrix_bot_honoroit_service_stat.stat.exists|bool"
- name: Ensure Matrix honoroit paths don't exist - name: Ensure Matrix honoroit paths don't exist
file: ansible.builtin.file:
path: "{{ matrix_bot_honoroit_base_path }}" path: "{{ matrix_bot_honoroit_base_path }}"
state: absent state: absent

View File

@ -1,7 +1,7 @@
--- ---
- name: Fail if required settings not defined - name: Fail if required settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"

View File

@ -1,5 +1,5 @@
--- ---
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-matrix-registration-bot.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-matrix-registration-bot.service'] }}"
when: matrix_bot_matrix_registration_bot_enabled|bool when: matrix_bot_matrix_registration_bot_enabled|bool

View File

@ -1,7 +1,7 @@
--- ---
- name: Ensure matrix-registration-bot paths exist - name: Ensure matrix-registration-bot paths exist
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -14,7 +14,7 @@
when: "item.when|bool" when: "item.when|bool"
- name: Ensure matrix-registration-bot configuration file created - name: Ensure matrix-registration-bot configuration file created
template: ansible.builtin.template:
src: "{{ role_path }}/templates/config/config.yml.j2" src: "{{ role_path }}/templates/config/config.yml.j2"
dest: "{{ matrix_bot_matrix_registration_bot_config_path }}/config.yml" dest: "{{ matrix_bot_matrix_registration_bot_config_path }}/config.yml"
owner: "{{ matrix_user_username }}" owner: "{{ matrix_user_username }}"
@ -34,7 +34,7 @@
until: result is not failed until: result is not failed
- name: Ensure matrix-registration-bot repository is present on self-build - name: Ensure matrix-registration-bot repository is present on self-build
git: ansible.builtin.git:
repo: "{{ matrix_bot_matrix_registration_bot_docker_repo }}" repo: "{{ matrix_bot_matrix_registration_bot_docker_repo }}"
dest: "{{ matrix_bot_matrix_registration_bot_docker_src_files_path }}" dest: "{{ matrix_bot_matrix_registration_bot_docker_src_files_path }}"
force: "yes" force: "yes"
@ -56,18 +56,18 @@
when: "matrix_bot_matrix_registration_bot_container_image_self_build|bool" when: "matrix_bot_matrix_registration_bot_container_image_self_build|bool"
- name: Ensure matrix-bot-matrix-registration-bot.service installed - name: Ensure matrix-bot-matrix-registration-bot.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-bot-matrix-registration-bot.service.j2" src: "{{ role_path }}/templates/systemd/matrix-bot-matrix-registration-bot.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-bot-matrix-registration-bot.service" dest: "{{ matrix_systemd_path }}/matrix-bot-matrix-registration-bot.service"
mode: 0644 mode: 0644
register: matrix_bot_matrix_registration_bot_systemd_service_result register: matrix_bot_matrix_registration_bot_systemd_service_result
- name: Ensure systemd reloaded after matrix-bot-matrix-registration-bot.service installation - name: Ensure systemd reloaded after matrix-bot-matrix-registration-bot.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_bot_matrix_registration_bot_systemd_service_result.changed|bool" when: "matrix_bot_matrix_registration_bot_systemd_service_result.changed|bool"
- name: Ensure matrix-bot-matrix-registration-bot.service restarted, if necessary - name: Ensure matrix-bot-matrix-registration-bot.service restarted, if necessary
service: ansible.builtin.service:
name: "matrix-bot-matrix-registration-bot.service" name: "matrix-bot-matrix-registration-bot.service"
state: restarted state: restarted

View File

@ -6,7 +6,7 @@
register: matrix_bot_matrix_registration_bot_service_stat register: matrix_bot_matrix_registration_bot_service_stat
- name: Ensure matrix-matrix-registration-bot is stopped - name: Ensure matrix-matrix-registration-bot is stopped
service: ansible.builtin.service:
name: matrix-bot-matrix-registration-bot name: matrix-bot-matrix-registration-bot
state: stopped state: stopped
enabled: false enabled: false
@ -15,18 +15,18 @@
when: "matrix_bot_matrix_registration_bot_service_stat.stat.exists|bool" when: "matrix_bot_matrix_registration_bot_service_stat.stat.exists|bool"
- name: Ensure matrix-bot-matrix-registration-bot.service doesn't exist - name: Ensure matrix-bot-matrix-registration-bot.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-bot-matrix-registration-bot.service" path: "{{ matrix_systemd_path }}/matrix-bot-matrix-registration-bot.service"
state: absent state: absent
when: "matrix_bot_matrix_registration_bot_service_stat.stat.exists|bool" when: "matrix_bot_matrix_registration_bot_service_stat.stat.exists|bool"
- name: Ensure systemd reloaded after matrix-bot-matrix-registration-bot.service removal - name: Ensure systemd reloaded after matrix-bot-matrix-registration-bot.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_bot_matrix_registration_bot_service_stat.stat.exists|bool" when: "matrix_bot_matrix_registration_bot_service_stat.stat.exists|bool"
- name: Ensure Matrix matrix-registration-bot paths don't exist - name: Ensure Matrix matrix-registration-bot paths don't exist
file: ansible.builtin.file:
path: "{{ matrix_bot_matrix_registration_bot_base_path }}" path: "{{ matrix_bot_matrix_registration_bot_base_path }}"
state: absent state: absent

View File

@ -1,7 +1,7 @@
--- ---
- name: Fail if required settings not defined - name: Fail if required settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"

View File

@ -1,5 +1,5 @@
--- ---
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-matrix-reminder-bot.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-matrix-reminder-bot.service'] }}"
when: matrix_bot_matrix_reminder_bot_enabled|bool when: matrix_bot_matrix_reminder_bot_enabled|bool

View File

@ -1,6 +1,6 @@
--- ---
- set_fact: - ansible.builtin.set_fact:
matrix_bot_matrix_reminder_bot_requires_restart: false matrix_bot_matrix_reminder_bot_requires_restart: false
- block: - block:
@ -10,7 +10,7 @@
register: matrix_bot_matrix_reminder_bot_sqlite_database_path_local_stat_result register: matrix_bot_matrix_reminder_bot_sqlite_database_path_local_stat_result
- block: - block:
- set_fact: - ansible.builtin.set_fact:
matrix_postgres_db_migration_request: matrix_postgres_db_migration_request:
src: "{{ matrix_bot_matrix_reminder_bot_sqlite_database_path_local }}" src: "{{ matrix_bot_matrix_reminder_bot_sqlite_database_path_local }}"
dst: "{{ matrix_bot_matrix_reminder_bot_database_connection_string }}" dst: "{{ matrix_bot_matrix_reminder_bot_database_connection_string }}"
@ -21,13 +21,13 @@
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
- set_fact: - ansible.builtin.set_fact:
matrix_bot_matrix_reminder_bot_requires_restart: true matrix_bot_matrix_reminder_bot_requires_restart: true
when: "matrix_bot_matrix_reminder_bot_sqlite_database_path_local_stat_result.stat.exists|bool" when: "matrix_bot_matrix_reminder_bot_sqlite_database_path_local_stat_result.stat.exists|bool"
when: "matrix_bot_matrix_reminder_bot_database_engine == 'postgres'" when: "matrix_bot_matrix_reminder_bot_database_engine == 'postgres'"
- name: Ensure matrix-reminder-bot paths exist - name: Ensure matrix-reminder-bot paths exist
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -53,7 +53,7 @@
until: result is not failed until: result is not failed
- name: Ensure matrix-reminder-bot repository is present on self-build - name: Ensure matrix-reminder-bot repository is present on self-build
git: ansible.builtin.git:
repo: "{{ matrix_bot_matrix_reminder_bot_docker_repo }}" repo: "{{ matrix_bot_matrix_reminder_bot_docker_repo }}"
dest: "{{ matrix_bot_matrix_reminder_bot_docker_src_files_path }}" dest: "{{ matrix_bot_matrix_reminder_bot_docker_src_files_path }}"
force: "yes" force: "yes"
@ -75,7 +75,7 @@
when: "matrix_bot_matrix_reminder_bot_container_image_self_build|bool" when: "matrix_bot_matrix_reminder_bot_container_image_self_build|bool"
- name: Ensure matrix-reminder-bot config installed - name: Ensure matrix-reminder-bot config installed
copy: ansible.builtin.copy:
content: "{{ matrix_bot_matrix_reminder_bot_configuration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_bot_matrix_reminder_bot_configuration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_bot_matrix_reminder_bot_config_path }}/config.yaml" dest: "{{ matrix_bot_matrix_reminder_bot_config_path }}/config.yaml"
mode: 0644 mode: 0644
@ -83,19 +83,19 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-bot-matrix-reminder-bot.service installed - name: Ensure matrix-bot-matrix-reminder-bot.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-bot-matrix-reminder-bot.service.j2" src: "{{ role_path }}/templates/systemd/matrix-bot-matrix-reminder-bot.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-bot-matrix-reminder-bot.service" dest: "{{ matrix_systemd_path }}/matrix-bot-matrix-reminder-bot.service"
mode: 0644 mode: 0644
register: matrix_bot_matrix_reminder_bot_systemd_service_result register: matrix_bot_matrix_reminder_bot_systemd_service_result
- name: Ensure systemd reloaded after matrix-bot-matrix-reminder-bot.service installation - name: Ensure systemd reloaded after matrix-bot-matrix-reminder-bot.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_bot_matrix_reminder_bot_systemd_service_result.changed|bool" when: "matrix_bot_matrix_reminder_bot_systemd_service_result.changed|bool"
- name: Ensure matrix-bot-matrix-reminder-bot.service restarted, if necessary - name: Ensure matrix-bot-matrix-reminder-bot.service restarted, if necessary
service: ansible.builtin.service:
name: "matrix-bot-matrix-reminder-bot.service" name: "matrix-bot-matrix-reminder-bot.service"
state: restarted state: restarted
when: "matrix_bot_matrix_reminder_bot_requires_restart|bool" when: "matrix_bot_matrix_reminder_bot_requires_restart|bool"

View File

@ -6,7 +6,7 @@
register: matrix_bot_matrix_reminder_bot_service_stat register: matrix_bot_matrix_reminder_bot_service_stat
- name: Ensure matrix-matrix-reminder-bot is stopped - name: Ensure matrix-matrix-reminder-bot is stopped
service: ansible.builtin.service:
name: matrix-bot-matrix-reminder-bot name: matrix-bot-matrix-reminder-bot
state: stopped state: stopped
enabled: false enabled: false
@ -15,18 +15,18 @@
when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists|bool" when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists|bool"
- name: Ensure matrix-bot-matrix-reminder-bot.service doesn't exist - name: Ensure matrix-bot-matrix-reminder-bot.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-bot-matrix-reminder-bot.service" path: "{{ matrix_systemd_path }}/matrix-bot-matrix-reminder-bot.service"
state: absent state: absent
when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists|bool" when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists|bool"
- name: Ensure systemd reloaded after matrix-bot-matrix-reminder-bot.service removal - name: Ensure systemd reloaded after matrix-bot-matrix-reminder-bot.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists|bool" when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists|bool"
- name: Ensure Matrix matrix-reminder-bot paths don't exist - name: Ensure Matrix matrix-reminder-bot paths don't exist
file: ansible.builtin.file:
path: "{{ matrix_bot_matrix_reminder_bot_base_path }}" path: "{{ matrix_bot_matrix_reminder_bot_base_path }}"
state: absent state: absent

View File

@ -1,7 +1,7 @@
--- ---
- name: Fail if required settings not defined - name: Fail if required settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"
@ -10,7 +10,7 @@
- "matrix_bot_matrix_reminder_bot_reminders_timezone" - "matrix_bot_matrix_reminder_bot_reminders_timezone"
- name: (Deprecation) Catch and report renamed settings - name: (Deprecation) Catch and report renamed settings
fail: ansible.builtin.fail:
msg: >- msg: >-
Your configuration contains a variable, which now has a different name. Your configuration contains a variable, which now has a different name.
Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).

View File

@ -2,10 +2,10 @@
# See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070
# and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407
- name: Fail if trying to self-build on Ansible < 2.8 - name: Fail if trying to self-build on Ansible < 2.8
fail: ansible.builtin.fail:
msg: "To self-build the Mjolnir image, you should use Ansible 2.8 or higher. See docs/ansible.md" msg: "To self-build the Mjolnir image, you should use Ansible 2.8 or higher. See docs/ansible.md"
when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_bot_mjolnir_container_image_self_build and matrix_bot_mjolnir_enabled" when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_bot_mjolnir_container_image_self_build and matrix_bot_mjolnir_enabled"
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-mjolnir.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-mjolnir.service'] }}"
when: matrix_bot_mjolnir_enabled|bool when: matrix_bot_mjolnir_enabled|bool

View File

@ -1,10 +1,10 @@
--- ---
- set_fact: - ansible.builtin.set_fact:
matrix_bot_mjolnir_requires_restart: false matrix_bot_mjolnir_requires_restart: false
- name: Ensure matrix-bot-mjolnir paths exist - name: Ensure matrix-bot-mjolnir paths exist
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -30,7 +30,7 @@
until: result is not failed until: result is not failed
- name: Ensure mjolnir repository is present on self-build - name: Ensure mjolnir repository is present on self-build
git: ansible.builtin.git:
repo: "{{ matrix_bot_mjolnir_container_image_self_build_repo }}" repo: "{{ matrix_bot_mjolnir_container_image_self_build_repo }}"
dest: "{{ matrix_bot_mjolnir_docker_src_files_path }}" dest: "{{ matrix_bot_mjolnir_docker_src_files_path }}"
version: "{{ matrix_bot_mjolnir_docker_image.split(':')[1] }}" version: "{{ matrix_bot_mjolnir_docker_image.split(':')[1] }}"
@ -52,7 +52,7 @@
when: "matrix_bot_mjolnir_container_image_self_build|bool" when: "matrix_bot_mjolnir_container_image_self_build|bool"
- name: Ensure matrix-bot-mjolnir config installed - name: Ensure matrix-bot-mjolnir config installed
copy: ansible.builtin.copy:
content: "{{ matrix_bot_mjolnir_configuration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_bot_mjolnir_configuration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_bot_mjolnir_config_path }}/production.yaml" dest: "{{ matrix_bot_mjolnir_config_path }}/production.yaml"
mode: 0644 mode: 0644
@ -60,19 +60,19 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-bot-mjolnir.service installed - name: Ensure matrix-bot-mjolnir.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-bot-mjolnir.service.j2" src: "{{ role_path }}/templates/systemd/matrix-bot-mjolnir.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-bot-mjolnir.service" dest: "{{ matrix_systemd_path }}/matrix-bot-mjolnir.service"
mode: 0644 mode: 0644
register: matrix_bot_mjolnir_systemd_service_result register: matrix_bot_mjolnir_systemd_service_result
- name: Ensure systemd reloaded after matrix-bot-mjolnir.service installation - name: Ensure systemd reloaded after matrix-bot-mjolnir.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_bot_mjolnir_systemd_service_result.changed|bool" when: "matrix_bot_mjolnir_systemd_service_result.changed|bool"
- name: Ensure matrix-bot-mjolnir.service restarted, if necessary - name: Ensure matrix-bot-mjolnir.service restarted, if necessary
service: ansible.builtin.service:
name: "matrix-bot-mjolnir.service" name: "matrix-bot-mjolnir.service"
state: restarted state: restarted
when: "matrix_bot_mjolnir_requires_restart|bool" when: "matrix_bot_mjolnir_requires_restart|bool"

View File

@ -6,7 +6,7 @@
register: matrix_bot_mjolnir_service_stat register: matrix_bot_mjolnir_service_stat
- name: Ensure matrix-bot-mjolnir is stopped - name: Ensure matrix-bot-mjolnir is stopped
service: ansible.builtin.service:
name: matrix-bot-mjolnir name: matrix-bot-mjolnir
state: stopped state: stopped
enabled: false enabled: false
@ -15,18 +15,18 @@
when: "matrix_bot_mjolnir_service_stat.stat.exists|bool" when: "matrix_bot_mjolnir_service_stat.stat.exists|bool"
- name: Ensure matrix-bot-mjolnir.service doesn't exist - name: Ensure matrix-bot-mjolnir.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-bot-mjolnir.service" path: "{{ matrix_systemd_path }}/matrix-bot-mjolnir.service"
state: absent state: absent
when: "matrix_bot_mjolnir_service_stat.stat.exists|bool" when: "matrix_bot_mjolnir_service_stat.stat.exists|bool"
- name: Ensure systemd reloaded after matrix-bot-mjolnir.service removal - name: Ensure systemd reloaded after matrix-bot-mjolnir.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_bot_mjolnir_service_stat.stat.exists|bool" when: "matrix_bot_mjolnir_service_stat.stat.exists|bool"
- name: Ensure matrix-bot-mjolnir paths don't exist - name: Ensure matrix-bot-mjolnir paths don't exist
file: ansible.builtin.file:
path: "{{ matrix_bot_mjolnir_base_path }}" path: "{{ matrix_bot_mjolnir_base_path }}"
state: absent state: absent

View File

@ -1,7 +1,7 @@
--- ---
- name: Fail if required variables are undefined - name: Fail if required variables are undefined
fail: ansible.builtin.fail:
msg: "The `{{ item }}` variable must be defined and have a non-null value." msg: "The `{{ item }}` variable must be defined and have a non-null value."
with_items: with_items:
- "matrix_bot_mjolnir_access_token" - "matrix_bot_mjolnir_access_token"

View File

@ -2,17 +2,17 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases. # We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed - name: Fail if matrix-synapse role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
The matrix-bridge-appservice-discord role needs to execute before the matrix-synapse role. The matrix-bridge-appservice-discord role needs to execute before the matrix-synapse role.
when: "matrix_appservice_discord_enabled and matrix_synapse_role_executed|default(False)" when: "matrix_appservice_discord_enabled and matrix_synapse_role_executed|default(False)"
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-discord.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-discord.service'] }}"
when: matrix_appservice_discord_enabled|bool when: matrix_appservice_discord_enabled|bool
# If the matrix-synapse role is not used, these variables may not exist. # If the matrix-synapse role is not used, these variables may not exist.
- set_fact: - ansible.builtin.set_fact:
matrix_synapse_container_extra_arguments: > matrix_synapse_container_extra_arguments: >
{{ {{
matrix_synapse_container_extra_arguments|default([]) matrix_synapse_container_extra_arguments|default([])

View File

@ -1,6 +1,6 @@
--- ---
- set_fact: - ansible.builtin.set_fact:
matrix_appservice_discord_requires_restart: false matrix_appservice_discord_requires_restart: false
- block: - block:
@ -10,7 +10,7 @@
register: matrix_appservice_discord_sqlite_database_path_local_stat_result register: matrix_appservice_discord_sqlite_database_path_local_stat_result
- block: - block:
- set_fact: - ansible.builtin.set_fact:
matrix_postgres_db_migration_request: matrix_postgres_db_migration_request:
src: "{{ matrix_appservice_discord_sqlite_database_path_local }}" src: "{{ matrix_appservice_discord_sqlite_database_path_local }}"
dst: "{{ matrix_appservice_discord_database_connString }}" dst: "{{ matrix_appservice_discord_database_connString }}"
@ -21,7 +21,7 @@
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
- set_fact: - ansible.builtin.set_fact:
matrix_appservice_discord_requires_restart: true matrix_appservice_discord_requires_restart: true
when: "matrix_appservice_discord_sqlite_database_path_local_stat_result.stat.exists|bool" when: "matrix_appservice_discord_sqlite_database_path_local_stat_result.stat.exists|bool"
when: "matrix_appservice_discord_database_engine == 'postgres'" when: "matrix_appservice_discord_database_engine == 'postgres'"
@ -38,7 +38,7 @@
until: result is not failed until: result is not failed
- name: Ensure AppService Discord paths exist - name: Ensure AppService Discord paths exist
file: ansible.builtin.file:
path: "{{ item }}" path: "{{ item }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -55,7 +55,7 @@
register: matrix_appservice_discord_stat_db register: matrix_appservice_discord_stat_db
- name: (Data relocation) Ensure matrix-appservice-discord.service is stopped - name: (Data relocation) Ensure matrix-appservice-discord.service is stopped
service: ansible.builtin.service:
name: matrix-appservice-discord name: matrix-appservice-discord
state: stopped state: stopped
enabled: false enabled: false
@ -64,7 +64,7 @@
when: "matrix_appservice_discord_stat_db.stat.exists" when: "matrix_appservice_discord_stat_db.stat.exists"
- name: (Data relocation) Move AppService Discord discord.db file to ./data directory - name: (Data relocation) Move AppService Discord discord.db file to ./data directory
command: "mv {{ matrix_appservice_discord_base_path }}/{{ item }} {{ matrix_appservice_discord_data_path }}/{{ item }}" ansible.builtin.command: "mv {{ matrix_appservice_discord_base_path }}/{{ item }} {{ matrix_appservice_discord_data_path }}/{{ item }}"
with_items: with_items:
- discord.db - discord.db
- user-store.db - user-store.db
@ -72,7 +72,7 @@
when: "matrix_appservice_discord_stat_db.stat.exists" when: "matrix_appservice_discord_stat_db.stat.exists"
- name: Ensure AppService Discord config.yaml installed - name: Ensure AppService Discord config.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_appservice_discord_configuration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_appservice_discord_configuration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_appservice_discord_config_path }}/config.yaml" dest: "{{ matrix_appservice_discord_config_path }}/config.yaml"
mode: 0644 mode: 0644
@ -80,7 +80,7 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure AppService Discord registration.yaml installed - name: Ensure AppService Discord registration.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_appservice_discord_registration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_appservice_discord_registration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_appservice_discord_config_path }}/registration.yaml" dest: "{{ matrix_appservice_discord_config_path }}/registration.yaml"
mode: 0644 mode: 0644
@ -90,7 +90,7 @@
# If `matrix_appservice_discord_client_id` hasn't changed, the same invite link would be generated. # If `matrix_appservice_discord_client_id` hasn't changed, the same invite link would be generated.
# We intentionally suppress Ansible changes. # We intentionally suppress Ansible changes.
- name: Generate AppService Discord invite link - name: Generate AppService Discord invite link
shell: >- ansible.builtin.shell: >-
{{ matrix_host_command_docker }} run --rm --name matrix-appservice-discord-link-gen {{ matrix_host_command_docker }} run --rm --name matrix-appservice-discord-link-gen
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} --user={{ matrix_user_uid }}:{{ matrix_user_gid }}
--cap-drop=ALL --cap-drop=ALL
@ -101,19 +101,19 @@
changed_when: false changed_when: false
- name: Ensure matrix-appservice-discord.service installed - name: Ensure matrix-appservice-discord.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-appservice-discord.service.j2" src: "{{ role_path }}/templates/systemd/matrix-appservice-discord.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-appservice-discord.service" dest: "{{ matrix_systemd_path }}/matrix-appservice-discord.service"
mode: 0644 mode: 0644
register: matrix_appservice_discord_systemd_service_result register: matrix_appservice_discord_systemd_service_result
- name: Ensure systemd reloaded after matrix-appservice-discord.service installation - name: Ensure systemd reloaded after matrix-appservice-discord.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_appservice_discord_systemd_service_result.changed" when: "matrix_appservice_discord_systemd_service_result.changed"
- name: Ensure matrix-appservice-discord.service restarted, if necessary - name: Ensure matrix-appservice-discord.service restarted, if necessary
service: ansible.builtin.service:
name: "matrix-appservice-discord.service" name: "matrix-appservice-discord.service"
state: restarted state: restarted
when: "matrix_appservice_discord_requires_restart|bool" when: "matrix_appservice_discord_requires_restart|bool"

View File

@ -6,7 +6,7 @@
register: matrix_appservice_discord_service_stat register: matrix_appservice_discord_service_stat
- name: Ensure matrix-appservice-discord is stopped - name: Ensure matrix-appservice-discord is stopped
service: ansible.builtin.service:
name: matrix-appservice-discord name: matrix-appservice-discord
state: stopped state: stopped
enabled: false enabled: false
@ -14,12 +14,12 @@
when: "matrix_appservice_discord_service_stat.stat.exists" when: "matrix_appservice_discord_service_stat.stat.exists"
- name: Ensure matrix-appservice-discord.service doesn't exist - name: Ensure matrix-appservice-discord.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-appservice-discord.service" path: "{{ matrix_systemd_path }}/matrix-appservice-discord.service"
state: absent state: absent
when: "matrix_appservice_discord_service_stat.stat.exists" when: "matrix_appservice_discord_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-appservice-discord.service removal - name: Ensure systemd reloaded after matrix-appservice-discord.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_appservice_discord_service_stat.stat.exists" when: "matrix_appservice_discord_service_stat.stat.exists"

View File

@ -1,7 +1,7 @@
--- ---
- name: Fail if required settings not defined - name: Fail if required settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"
@ -13,7 +13,7 @@
- "matrix_appservice_discord_homeserver_domain" - "matrix_appservice_discord_homeserver_domain"
- name: (Deprecation) Catch and report renamed appservice-discord variables - name: (Deprecation) Catch and report renamed appservice-discord variables
fail: ansible.builtin.fail:
msg: >- msg: >-
Your configuration contains a variable, which now has a different name. Your configuration contains a variable, which now has a different name.
Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
@ -22,5 +22,5 @@
- {'old': 'matrix_appservice_discord_container_expose_client_server_api_port', 'new': '<superseded by matrix_appservice_discord_container_http_host_bind_port>'} - {'old': 'matrix_appservice_discord_container_expose_client_server_api_port', 'new': '<superseded by matrix_appservice_discord_container_http_host_bind_port>'}
- name: Require a valid database engine - name: Require a valid database engine
fail: msg="`matrix_appservice_discord_database_engine` needs to be either 'sqlite' or 'postgres'" ansible.builtin.fail: msg="`matrix_appservice_discord_database_engine` needs to be either 'sqlite' or 'postgres'"
when: "matrix_appservice_discord_database_engine not in ['sqlite', 'postgres']" when: "matrix_appservice_discord_database_engine not in ['sqlite', 'postgres']"

View File

@ -2,24 +2,24 @@
# See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070
# and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407
- name: Fail if trying to self-build on Ansible < 2.8 - name: Fail if trying to self-build on Ansible < 2.8
fail: ansible.builtin.fail:
msg: "To self-build the Element image, you should use Ansible 2.8 or higher. See docs/ansible.md" msg: "To self-build the Element image, you should use Ansible 2.8 or higher. See docs/ansible.md"
when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_appservice_irc_container_image_self_build and matrix_appservice_irc_enabled" when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_appservice_irc_container_image_self_build and matrix_appservice_irc_enabled"
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases. # We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed - name: Fail if matrix-synapse role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
The matrix-bridge-appservice-irc role needs to execute before the matrix-synapse role. The matrix-bridge-appservice-irc role needs to execute before the matrix-synapse role.
when: "matrix_appservice_irc_enabled|bool and matrix_synapse_role_executed|default(False)" when: "matrix_appservice_irc_enabled|bool and matrix_synapse_role_executed|default(False)"
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-irc.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-irc.service'] }}"
when: matrix_appservice_irc_enabled|bool when: matrix_appservice_irc_enabled|bool
# If the matrix-synapse role is not used, these variables may not exist. # If the matrix-synapse role is not used, these variables may not exist.
- set_fact: - ansible.builtin.set_fact:
matrix_synapse_container_extra_arguments: > matrix_synapse_container_extra_arguments: >
{{ {{
matrix_synapse_container_extra_arguments|default([]) matrix_synapse_container_extra_arguments|default([])

View File

@ -1,21 +1,21 @@
--- ---
- name: Fail if Postgres not enabled - name: Fail if Postgres not enabled
fail: ansible.builtin.fail:
msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot migrate." msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot migrate."
when: "not matrix_postgres_enabled|bool" when: "not matrix_postgres_enabled|bool"
# Defaults # Defaults
- name: Set postgres_start_wait_time, if not provided - name: Set postgres_start_wait_time, if not provided
set_fact: ansible.builtin.set_fact:
postgres_start_wait_time: 15 postgres_start_wait_time: 15
when: "postgres_start_wait_time|default('') == ''" when: "postgres_start_wait_time|default('') == ''"
# Actual import work # Actual import work
- name: Ensure matrix-postgres is started - name: Ensure matrix-postgres is started
service: ansible.builtin.service:
name: matrix-postgres name: matrix-postgres
state: started state: started
daemon_reload: true daemon_reload: true
@ -34,13 +34,13 @@
register: matrix_appservice_irc_service_stat register: matrix_appservice_irc_service_stat
- name: Ensure matrix-appservice-irc is stopped - name: Ensure matrix-appservice-irc is stopped
service: ansible.builtin.service:
name: matrix-appservice-irc name: matrix-appservice-irc
state: stopped state: stopped
when: "matrix_appservice_irc_service_stat.stat.exists" when: "matrix_appservice_irc_service_stat.stat.exists"
- name: Import appservice-irc NeDB database into Postgres - name: Import appservice-irc NeDB database into Postgres
command: ansible.builtin.command:
cmd: >- cmd: >-
{{ matrix_host_command_docker }} run {{ matrix_host_command_docker }} run
--rm --rm
@ -54,14 +54,14 @@
'/usr/local/bin/node /app/lib/scripts/migrate-db-to-pgres.js --dbdir /data --privateKey /data/passkey.pem --connectionString {{ matrix_appservice_irc_database_connection_string }}' '/usr/local/bin/node /app/lib/scripts/migrate-db-to-pgres.js --dbdir /data --privateKey /data/passkey.pem --connectionString {{ matrix_appservice_irc_database_connection_string }}'
- name: Archive NeDB database files - name: Archive NeDB database files
command: ansible.builtin.command:
cmd: "mv {{ matrix_appservice_irc_data_path }}/{{ item }} {{ matrix_appservice_irc_data_path }}/{{ item }}.backup" cmd: "mv {{ matrix_appservice_irc_data_path }}/{{ item }} {{ matrix_appservice_irc_data_path }}/{{ item }}.backup"
with_items: with_items:
- rooms.db - rooms.db
- users.db - users.db
- name: Inject result - name: Inject result
set_fact: ansible.builtin.set_fact:
matrix_playbook_runtime_results: | matrix_playbook_runtime_results: |
{{ {{
matrix_playbook_runtime_results|default([]) matrix_playbook_runtime_results|default([])

View File

@ -3,7 +3,7 @@
- import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml" - import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml"
- name: Ensure Appservice IRC paths exist - name: Ensure Appservice IRC paths exist
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -23,24 +23,24 @@
- block: - block:
- name: (Data relocation) Ensure matrix-appservice-irc.service is stopped - name: (Data relocation) Ensure matrix-appservice-irc.service is stopped
service: ansible.builtin.service:
name: matrix-appservice-irc name: matrix-appservice-irc
state: stopped state: stopped
daemon_reload: true daemon_reload: true
failed_when: false failed_when: false
- name: (Data relocation) Move AppService IRC passkey.pem file to ./data directory - name: (Data relocation) Move AppService IRC passkey.pem file to ./data directory
command: "mv {{ matrix_appservice_irc_base_path }}/passkey.pem {{ matrix_appservice_irc_data_path }}/passkey.pem" ansible.builtin.command: "mv {{ matrix_appservice_irc_base_path }}/passkey.pem {{ matrix_appservice_irc_data_path }}/passkey.pem"
- name: (Data relocation) Move AppService IRC database files to ./data directory - name: (Data relocation) Move AppService IRC database files to ./data directory
command: "mv {{ matrix_appservice_irc_base_path }}/{{ item }} {{ matrix_appservice_irc_data_path }}/{{ item }}" ansible.builtin.command: "mv {{ matrix_appservice_irc_base_path }}/{{ item }} {{ matrix_appservice_irc_data_path }}/{{ item }}"
with_items: with_items:
- rooms.db - rooms.db
- users.db - users.db
failed_when: false failed_when: false
when: "matrix_appservice_irc_stat_passkey.stat.exists" when: "matrix_appservice_irc_stat_passkey.stat.exists"
- set_fact: - ansible.builtin.set_fact:
matrix_appservice_irc_requires_restart: false matrix_appservice_irc_requires_restart: false
- block: - block:
@ -52,7 +52,7 @@
- block: - block:
- import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml" - import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml"
- set_fact: - ansible.builtin.set_fact:
matrix_appservice_irc_requires_restart: true matrix_appservice_irc_requires_restart: true
when: "matrix_appservice_irc_nedb_database_path_local_stat_result.stat.exists|bool" when: "matrix_appservice_irc_nedb_database_path_local_stat_result.stat.exists|bool"
when: "matrix_appservice_irc_database_engine == 'postgres'" when: "matrix_appservice_irc_database_engine == 'postgres'"
@ -70,7 +70,7 @@
until: result is not failed until: result is not failed
- name: Ensure matrix-appservice-irc repository is present when self-building - name: Ensure matrix-appservice-irc repository is present when self-building
git: ansible.builtin.git:
repo: "{{ matrix_appservice_irc_docker_repo }}" repo: "{{ matrix_appservice_irc_docker_repo }}"
dest: "{{ matrix_appservice_irc_docker_src_files_path }}" dest: "{{ matrix_appservice_irc_docker_src_files_path }}"
force: "yes" force: "yes"
@ -92,7 +92,7 @@
when: "matrix_appservice_irc_enabled|bool and matrix_appservice_irc_container_image_self_build|bool and matrix_appservice_irc_git_pull_results.changed" when: "matrix_appservice_irc_enabled|bool and matrix_appservice_irc_container_image_self_build|bool and matrix_appservice_irc_git_pull_results.changed"
- name: Ensure Matrix Appservice IRC config installed - name: Ensure Matrix Appservice IRC config installed
copy: ansible.builtin.copy:
content: "{{ matrix_appservice_irc_configuration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_appservice_irc_configuration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_appservice_irc_config_path }}/config.yaml" dest: "{{ matrix_appservice_irc_config_path }}/config.yaml"
mode: 0644 mode: 0644
@ -105,7 +105,7 @@
register: irc_passkey_file register: irc_passkey_file
- name: Generate Appservice IRC passkey if it doesn't exist - name: Generate Appservice IRC passkey if it doesn't exist
shell: "{{ matrix_host_command_openssl }} genpkey -out {{ matrix_appservice_irc_data_path }}/passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:2048" ansible.builtin.shell: "{{ matrix_host_command_openssl }} genpkey -out {{ matrix_appservice_irc_data_path }}/passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:2048"
become: true become: true
become_user: "{{ matrix_user_username }}" become_user: "{{ matrix_user_username }}"
when: "not irc_passkey_file.stat.exists" when: "not irc_passkey_file.stat.exists"
@ -113,7 +113,7 @@
# In the past, we used to generate the passkey.pem file with root, so permissions may not be okay. # In the past, we used to generate the passkey.pem file with root, so permissions may not be okay.
# Fix it. # Fix it.
- name: (Migration) Ensure Appservice IRC passkey permissions are okay - name: (Migration) Ensure Appservice IRC passkey permissions are okay
file: ansible.builtin.file:
path: "{{ matrix_appservice_irc_data_path }}/passkey.pem" path: "{{ matrix_appservice_irc_data_path }}/passkey.pem"
mode: 0644 mode: 0644
owner: "{{ matrix_user_username }}" owner: "{{ matrix_user_username }}"
@ -139,7 +139,7 @@
# an up-to-date file, and we fix it up with some static values later on, # an up-to-date file, and we fix it up with some static values later on,
# to produce a final registration.yaml file, as we desire. # to produce a final registration.yaml file, as we desire.
- name: Generate Appservice IRC registration-template.yaml - name: Generate Appservice IRC registration-template.yaml
shell: >- ansible.builtin.shell: >-
{{ matrix_host_command_docker }} run --rm --name matrix-appservice-irc-gen {{ matrix_host_command_docker }} run --rm --name matrix-appservice-irc-gen
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} --user={{ matrix_user_uid }}:{{ matrix_user_gid }}
--cap-drop=ALL --cap-drop=ALL
@ -157,26 +157,26 @@
changed_when: false changed_when: false
- name: Read Appservice IRC registration-template.yaml - name: Read Appservice IRC registration-template.yaml
slurp: ansible.builtin.slurp:
src: "{{ matrix_appservice_irc_config_path }}/registration-template.yaml" src: "{{ matrix_appservice_irc_config_path }}/registration-template.yaml"
register: matrix_appservice_irc_registration_template_slurp register: matrix_appservice_irc_registration_template_slurp
- name: Remove unnecessary Appservice IRC registration-template.yaml - name: Remove unnecessary Appservice IRC registration-template.yaml
file: ansible.builtin.file:
path: "{{ matrix_appservice_irc_config_path }}/registration-template.yaml" path: "{{ matrix_appservice_irc_config_path }}/registration-template.yaml"
state: absent state: absent
changed_when: false changed_when: false
- name: Parse registration-template.yaml - name: Parse registration-template.yaml
set_fact: ansible.builtin.set_fact:
matrix_appservice_irc_registration_template: "{{ matrix_appservice_irc_registration_template_slurp['content'] | b64decode | from_yaml }}" matrix_appservice_irc_registration_template: "{{ matrix_appservice_irc_registration_template_slurp['content'] | b64decode | from_yaml }}"
- name: Combine registration-template.yaml and own registration override config - name: Combine registration-template.yaml and own registration override config
set_fact: ansible.builtin.set_fact:
matrix_appservice_irc_registration: "{{ matrix_appservice_irc_registration_template|combine(matrix_appservice_irc_registration_override, recursive=True) }}" matrix_appservice_irc_registration: "{{ matrix_appservice_irc_registration_template|combine(matrix_appservice_irc_registration_override, recursive=True) }}"
- name: Ensure Appservice IRC registration.yaml installed - name: Ensure Appservice IRC registration.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_appservice_irc_registration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_appservice_irc_registration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_appservice_irc_config_path }}/registration.yaml" dest: "{{ matrix_appservice_irc_config_path }}/registration.yaml"
mode: 0644 mode: 0644
@ -184,19 +184,19 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-appservice-irc.service installed - name: Ensure matrix-appservice-irc.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-appservice-irc.service.j2" src: "{{ role_path }}/templates/systemd/matrix-appservice-irc.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-appservice-irc.service" dest: "{{ matrix_systemd_path }}/matrix-appservice-irc.service"
mode: 0644 mode: 0644
register: matrix_appservice_irc_systemd_service_result register: matrix_appservice_irc_systemd_service_result
- name: Ensure systemd reloaded after matrix-appservice-irc.service installation - name: Ensure systemd reloaded after matrix-appservice-irc.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_appservice_irc_systemd_service_result.changed" when: "matrix_appservice_irc_systemd_service_result.changed"
- name: Ensure matrix-appservice-irc.service restarted, if necessary - name: Ensure matrix-appservice-irc.service restarted, if necessary
service: ansible.builtin.service:
name: "matrix-appservice-irc.service" name: "matrix-appservice-irc.service"
state: restarted state: restarted
when: "matrix_appservice_irc_requires_restart|bool" when: "matrix_appservice_irc_requires_restart|bool"

View File

@ -6,7 +6,7 @@
register: matrix_appservice_irc_service_stat register: matrix_appservice_irc_service_stat
- name: Ensure matrix-appservice-irc is stopped - name: Ensure matrix-appservice-irc is stopped
service: ansible.builtin.service:
name: matrix-appservice-irc name: matrix-appservice-irc
state: stopped state: stopped
enabled: false enabled: false
@ -14,12 +14,12 @@
when: "matrix_appservice_irc_service_stat.stat.exists" when: "matrix_appservice_irc_service_stat.stat.exists"
- name: Ensure matrix-appservice-irc.service doesn't exist - name: Ensure matrix-appservice-irc.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-appservice-irc.service" path: "{{ matrix_systemd_path }}/matrix-appservice-irc.service"
state: absent state: absent
when: "matrix_appservice_irc_service_stat.stat.exists" when: "matrix_appservice_irc_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-appservice-irc.service removal - name: Ensure systemd reloaded after matrix-appservice-irc.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_appservice_irc_service_stat.stat.exists" when: "matrix_appservice_irc_service_stat.stat.exists"

View File

@ -1,7 +1,7 @@
--- ---
- name: Fail if required settings not defined - name: Fail if required settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"
@ -17,7 +17,7 @@
# #
# This is a safety check to ensure we fail earlier and in a nicer way. # This is a safety check to ensure we fail earlier and in a nicer way.
- name: Fail if no additional configuration provided - name: Fail if no additional configuration provided
fail: ansible.builtin.fail:
msg: >- msg: >-
Your Appservice IRC configuration is incomplete (lacking an `ircService.servers` configuration). Your Appservice IRC configuration is incomplete (lacking an `ircService.servers` configuration).
You need to define one or more servers by either using `matrix_appservice_irc_ircService_servers` You need to define one or more servers by either using `matrix_appservice_irc_ircService_servers`
@ -26,7 +26,7 @@
when: "matrix_appservice_irc_configuration.ircService.servers|length == 0" when: "matrix_appservice_irc_configuration.ircService.servers|length == 0"
- name: (Deprecation) Catch and report renamed appservice-irc variables - name: (Deprecation) Catch and report renamed appservice-irc variables
fail: ansible.builtin.fail:
msg: >- msg: >-
Your configuration contains a variable, which now has a different name. Your configuration contains a variable, which now has a different name.
Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).

View File

@ -2,24 +2,24 @@
# See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070
# and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407
- name: Fail if trying to self-build on Ansible < 2.8 - name: Fail if trying to self-build on Ansible < 2.8
fail: ansible.builtin.fail:
msg: "To self-build the Element image, you should use Ansible 2.8 or higher. See docs/ansible.md" msg: "To self-build the Element image, you should use Ansible 2.8 or higher. See docs/ansible.md"
when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_appservice_slack_container_image_self_build and matrix_appservice_slack_enabled" when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_appservice_slack_container_image_self_build and matrix_appservice_slack_enabled"
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases. # We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed - name: Fail if matrix-synapse role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
The matrix-bridge-appservice-slack role needs to execute before the matrix-synapse role. The matrix-bridge-appservice-slack role needs to execute before the matrix-synapse role.
when: "matrix_synapse_role_executed|default(False)" when: "matrix_synapse_role_executed|default(False)"
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-slack.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-slack.service'] }}"
when: matrix_appservice_slack_enabled|bool when: matrix_appservice_slack_enabled|bool
# If the matrix-synapse role is not used, these variables may not exist. # If the matrix-synapse role is not used, these variables may not exist.
- set_fact: - ansible.builtin.set_fact:
matrix_synapse_container_extra_arguments: > matrix_synapse_container_extra_arguments: >
{{ {{
matrix_synapse_container_extra_arguments|default([]) matrix_synapse_container_extra_arguments|default([])
@ -38,14 +38,14 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases. # We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed - name: Fail if matrix-synapse role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
The matrix-bridge-appservice-slack role needs to execute before the matrix-synapse role. The matrix-bridge-appservice-slack role needs to execute before the matrix-synapse role.
when: "matrix_synapse_role_executed|default(False)" when: "matrix_synapse_role_executed|default(False)"
- block: - block:
- name: Fail if matrix-nginx-proxy role already executed - name: Fail if matrix-nginx-proxy role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
Trying to append Slack Appservice's reverse-proxying configuration to matrix-nginx-proxy, Trying to append Slack Appservice's reverse-proxying configuration to matrix-nginx-proxy,
but it's pointless since the matrix-nginx-proxy role had already executed. but it's pointless since the matrix-nginx-proxy role had already executed.
@ -54,7 +54,7 @@
when: matrix_nginx_proxy_role_executed|default(False)|bool when: matrix_nginx_proxy_role_executed|default(False)|bool
- name: Generate Matrix Appservice Slack proxying configuration for matrix-nginx-proxy - name: Generate Matrix Appservice Slack proxying configuration for matrix-nginx-proxy
set_fact: ansible.builtin.set_fact:
matrix_appservice_slack_matrix_nginx_proxy_configuration: | matrix_appservice_slack_matrix_nginx_proxy_configuration: |
location {{ matrix_appservice_slack_public_endpoint }} { location {{ matrix_appservice_slack_public_endpoint }} {
{% if matrix_nginx_proxy_enabled|default(False) %} {% if matrix_nginx_proxy_enabled|default(False) %}
@ -69,7 +69,7 @@
} }
- name: Register Slack Appservice proxying configuration with matrix-nginx-proxy - name: Register Slack Appservice proxying configuration with matrix-nginx-proxy
set_fact: ansible.builtin.set_fact:
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
{{ {{
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([])
@ -81,7 +81,7 @@
when: matrix_appservice_slack_enabled|bool when: matrix_appservice_slack_enabled|bool
- name: Warn about reverse-proxying if matrix-nginx-proxy not used - name: Warn about reverse-proxying if matrix-nginx-proxy not used
debug: ansible.builtin.debug:
msg: >- msg: >-
NOTE: You've enabled the Matrix Slack bridge but are not using the matrix-nginx-proxy NOTE: You've enabled the Matrix Slack bridge but are not using the matrix-nginx-proxy
reverse proxy. reverse proxy.

View File

@ -1,21 +1,21 @@
--- ---
- name: Fail if Postgres not enabled - name: Fail if Postgres not enabled
fail: ansible.builtin.fail:
msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot migrate." msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot migrate."
when: "not matrix_postgres_enabled|bool" when: "not matrix_postgres_enabled|bool"
# Defaults # Defaults
- name: Set postgres_start_wait_time, if not provided - name: Set postgres_start_wait_time, if not provided
set_fact: ansible.builtin.set_fact:
postgres_start_wait_time: 15 postgres_start_wait_time: 15
when: "postgres_start_wait_time|default('') == ''" when: "postgres_start_wait_time|default('') == ''"
# Actual import work # Actual import work
- name: Ensure matrix-postgres is started - name: Ensure matrix-postgres is started
service: ansible.builtin.service:
name: matrix-postgres name: matrix-postgres
state: started state: started
daemon_reload: true daemon_reload: true
@ -29,12 +29,12 @@
when: "matrix_postgres_service_start_result.changed|bool" when: "matrix_postgres_service_start_result.changed|bool"
- name: Ensure matrix-appservice-slack is stopped - name: Ensure matrix-appservice-slack is stopped
service: ansible.builtin.service:
name: matrix-appservice-slack name: matrix-appservice-slack
state: stopped state: stopped
- name: Import appservice-slack NeDB database into Postgres - name: Import appservice-slack NeDB database into Postgres
command: ansible.builtin.command:
cmd: >- cmd: >-
{{ matrix_host_command_docker }} run {{ matrix_host_command_docker }} run
--rm --rm
@ -48,7 +48,7 @@
'/usr/local/bin/node /usr/src/app/lib/scripts/migrateToPostgres.js --dbdir /data --connectionString {{ matrix_appservice_slack_database_connection_string }}' '/usr/local/bin/node /usr/src/app/lib/scripts/migrateToPostgres.js --dbdir /data --connectionString {{ matrix_appservice_slack_database_connection_string }}'
- name: Archive NeDB database files - name: Archive NeDB database files
command: ansible.builtin.command:
cmd: "mv {{ matrix_appservice_slack_data_path }}/{{ item }} {{ matrix_appservice_slack_data_path }}/{{ item }}.backup" cmd: "mv {{ matrix_appservice_slack_data_path }}/{{ item }} {{ matrix_appservice_slack_data_path }}/{{ item }}.backup"
with_items: with_items:
- teams.db - teams.db
@ -57,7 +57,7 @@
- event-store.db - event-store.db
- name: Inject result - name: Inject result
set_fact: ansible.builtin.set_fact:
matrix_playbook_runtime_results: | matrix_playbook_runtime_results: |
{{ {{
matrix_playbook_runtime_results|default([]) matrix_playbook_runtime_results|default([])

View File

@ -1,7 +1,7 @@
--- ---
- name: Ensure AppService Slack paths exist - name: Ensure AppService Slack paths exist
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -14,7 +14,7 @@
- {path: "{{ matrix_appservice_slack_docker_src_files_path }}", when: "{{ matrix_appservice_slack_container_image_self_build }}"} - {path: "{{ matrix_appservice_slack_docker_src_files_path }}", when: "{{ matrix_appservice_slack_container_image_self_build }}"}
when: item.when|bool when: item.when|bool
- set_fact: - ansible.builtin.set_fact:
matrix_appservice_slack_requires_restart: false matrix_appservice_slack_requires_restart: false
- block: - block:
@ -26,7 +26,7 @@
- block: - block:
- import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml" - import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml"
- set_fact: - ansible.builtin.set_fact:
matrix_appservice_slack_requires_restart: true matrix_appservice_slack_requires_restart: true
when: "matrix_appservice_slack_nedb_database_path_local_stat_result.stat.exists|bool" when: "matrix_appservice_slack_nedb_database_path_local_stat_result.stat.exists|bool"
when: "matrix_appservice_slack_database_engine == 'postgres'" when: "matrix_appservice_slack_database_engine == 'postgres'"
@ -44,7 +44,7 @@
until: result is not failed until: result is not failed
- name: Ensure matrix-appservice-slack repository is present when self-building - name: Ensure matrix-appservice-slack repository is present when self-building
git: ansible.builtin.git:
repo: "{{ matrix_appservice_slack_docker_repo }}" repo: "{{ matrix_appservice_slack_docker_repo }}"
dest: "{{ matrix_appservice_slack_docker_src_files_path }}" dest: "{{ matrix_appservice_slack_docker_src_files_path }}"
force: "yes" force: "yes"
@ -66,7 +66,7 @@
when: "matrix_appservice_slack_container_image_self_build|bool and matrix_appservice_slack_git_pull_results.changed" when: "matrix_appservice_slack_container_image_self_build|bool and matrix_appservice_slack_git_pull_results.changed"
- name: Ensure Matrix Appservice Slack config installed - name: Ensure Matrix Appservice Slack config installed
copy: ansible.builtin.copy:
content: "{{ matrix_appservice_slack_configuration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_appservice_slack_configuration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_appservice_slack_config_path }}/config.yaml" dest: "{{ matrix_appservice_slack_config_path }}/config.yaml"
mode: 0644 mode: 0644
@ -74,7 +74,7 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure appservice-slack registration.yaml installed - name: Ensure appservice-slack registration.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_appservice_slack_registration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_appservice_slack_registration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_appservice_slack_config_path }}/slack-registration.yaml" dest: "{{ matrix_appservice_slack_config_path }}/slack-registration.yaml"
mode: 0644 mode: 0644
@ -82,19 +82,19 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-appservice-slack.service installed - name: Ensure matrix-appservice-slack.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-appservice-slack.service.j2" src: "{{ role_path }}/templates/systemd/matrix-appservice-slack.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-appservice-slack.service" dest: "{{ matrix_systemd_path }}/matrix-appservice-slack.service"
mode: 0644 mode: 0644
register: matrix_appservice_slack_systemd_service_result register: matrix_appservice_slack_systemd_service_result
- name: Ensure systemd reloaded after matrix-appservice-slack.service installation - name: Ensure systemd reloaded after matrix-appservice-slack.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_appservice_slack_systemd_service_result.changed" when: "matrix_appservice_slack_systemd_service_result.changed"
- name: Ensure matrix-appservice-slack.service restarted, if necessary - name: Ensure matrix-appservice-slack.service restarted, if necessary
service: ansible.builtin.service:
name: "matrix-appservice-slack.service" name: "matrix-appservice-slack.service"
state: restarted state: restarted
when: "matrix_appservice_slack_requires_restart|bool" when: "matrix_appservice_slack_requires_restart|bool"

View File

@ -6,7 +6,7 @@
register: matrix_appservice_slack_service_stat register: matrix_appservice_slack_service_stat
- name: Ensure matrix-appservice-slack is stopped - name: Ensure matrix-appservice-slack is stopped
service: ansible.builtin.service:
name: matrix-appservice-slack name: matrix-appservice-slack
state: stopped state: stopped
enabled: false enabled: false
@ -14,12 +14,12 @@
when: "matrix_appservice_slack_service_stat.stat.exists" when: "matrix_appservice_slack_service_stat.stat.exists"
- name: Ensure matrix-appservice-slack.service doesn't exist - name: Ensure matrix-appservice-slack.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-appservice-slack.service" path: "{{ matrix_systemd_path }}/matrix-appservice-slack.service"
state: absent state: absent
when: "matrix_appservice_slack_service_stat.stat.exists" when: "matrix_appservice_slack_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-appservice-slack.service removal - name: Ensure systemd reloaded after matrix-appservice-slack.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_appservice_slack_service_stat.stat.exists" when: "matrix_appservice_slack_service_stat.stat.exists"

View File

@ -1,7 +1,7 @@
--- ---
- name: Fail if required settings not defined - name: Fail if required settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"
@ -13,7 +13,7 @@
- "matrix_appservice_slack_id_token" - "matrix_appservice_slack_id_token"
- name: (Deprecation) Catch and report renamed settings - name: (Deprecation) Catch and report renamed settings
fail: ansible.builtin.fail:
msg: >- msg: >-
Your configuration contains a variable, which now has a different name. Your configuration contains a variable, which now has a different name.
Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).

View File

@ -2,17 +2,17 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases. # We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed - name: Fail if matrix-synapse role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
The matrix-bridge-appservice-webhooks role needs to execute before the matrix-synapse role. The matrix-bridge-appservice-webhooks role needs to execute before the matrix-synapse role.
when: "matrix_synapse_role_executed|default(False)" when: "matrix_synapse_role_executed|default(False)"
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-webhooks.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-webhooks.service'] }}"
when: matrix_appservice_webhooks_enabled|bool when: matrix_appservice_webhooks_enabled|bool
# If the matrix-synapse role is not used, these variables may not exist. # If the matrix-synapse role is not used, these variables may not exist.
- set_fact: - ansible.builtin.set_fact:
matrix_synapse_container_extra_arguments: > matrix_synapse_container_extra_arguments: >
{{ {{
matrix_synapse_container_extra_arguments|default([]) matrix_synapse_container_extra_arguments|default([])
@ -31,14 +31,14 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases. # We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed - name: Fail if matrix-synapse role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
The matrix-bridge-appservice-webhooks role needs to execute before the matrix-synapse role. The matrix-bridge-appservice-webhooks role needs to execute before the matrix-synapse role.
when: "matrix_synapse_role_executed|default(False)" when: "matrix_synapse_role_executed|default(False)"
- block: - block:
- name: Fail if matrix-nginx-proxy role already executed - name: Fail if matrix-nginx-proxy role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
Trying to append webhooks Appservice's reverse-proxying configuration to matrix-nginx-proxy, Trying to append webhooks Appservice's reverse-proxying configuration to matrix-nginx-proxy,
but it's pointless since the matrix-nginx-proxy role had already executed. but it's pointless since the matrix-nginx-proxy role had already executed.
@ -47,7 +47,7 @@
when: matrix_nginx_proxy_role_executed|default(False)|bool when: matrix_nginx_proxy_role_executed|default(False)|bool
- name: Generate Matrix Appservice webhooks proxying configuration for matrix-nginx-proxy - name: Generate Matrix Appservice webhooks proxying configuration for matrix-nginx-proxy
set_fact: ansible.builtin.set_fact:
matrix_appservice_webhooks_matrix_nginx_proxy_configuration: | matrix_appservice_webhooks_matrix_nginx_proxy_configuration: |
{% if matrix_nginx_proxy_enabled|default(False) %} {% if matrix_nginx_proxy_enabled|default(False) %}
{# Use the embedded DNS resolver in Docker containers to discover the service #} {# Use the embedded DNS resolver in Docker containers to discover the service #}
@ -64,7 +64,7 @@
{% endif %} {% endif %}
- name: Register webhooks Appservice proxying configuration with matrix-nginx-proxy - name: Register webhooks Appservice proxying configuration with matrix-nginx-proxy
set_fact: ansible.builtin.set_fact:
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
{{ {{
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([])
@ -76,7 +76,7 @@
when: matrix_appservice_webhooks_enabled|bool when: matrix_appservice_webhooks_enabled|bool
- name: Warn about reverse-proxying if matrix-nginx-proxy not used - name: Warn about reverse-proxying if matrix-nginx-proxy not used
debug: ansible.builtin.debug:
msg: >- msg: >-
NOTE: You've enabled the Matrix webhooks bridge but are not using the matrix-nginx-proxy NOTE: You've enabled the Matrix webhooks bridge but are not using the matrix-nginx-proxy
reverse proxy. reverse proxy.

View File

@ -1,7 +1,7 @@
--- ---
- name: Ensure AppService webhooks paths exist - name: Ensure AppService webhooks paths exist
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -28,7 +28,7 @@
- block: - block:
- name: Ensure Appservice webhooks repository is present on self-build - name: Ensure Appservice webhooks repository is present on self-build
git: ansible.builtin.git:
repo: "{{ matrix_appservice_webhooks_container_image_self_build_repo }}" repo: "{{ matrix_appservice_webhooks_container_image_self_build_repo }}"
dest: "{{ matrix_appservice_webhooks_docker_src_files_path }}" dest: "{{ matrix_appservice_webhooks_docker_src_files_path }}"
version: "{{ matrix_appservice_webhooks_container_image_self_build_repo_version }}" version: "{{ matrix_appservice_webhooks_container_image_self_build_repo_version }}"
@ -50,7 +50,7 @@
when: "matrix_appservice_webhooks_container_image_self_build|bool" when: "matrix_appservice_webhooks_container_image_self_build|bool"
- name: Ensure Matrix Appservice webhooks config is installed - name: Ensure Matrix Appservice webhooks config is installed
copy: ansible.builtin.copy:
content: "{{ matrix_appservice_webhooks_configuration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_appservice_webhooks_configuration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_appservice_webhooks_config_path }}/config.yaml" dest: "{{ matrix_appservice_webhooks_config_path }}/config.yaml"
mode: 0644 mode: 0644
@ -58,7 +58,7 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure Matrix Appservice webhooks schema.yml template exists - name: Ensure Matrix Appservice webhooks schema.yml template exists
template: ansible.builtin.template:
src: "{{ role_path }}/templates/schema.yml.j2" src: "{{ role_path }}/templates/schema.yml.j2"
dest: "{{ matrix_appservice_webhooks_config_path }}/schema.yml" dest: "{{ matrix_appservice_webhooks_config_path }}/schema.yml"
mode: 0644 mode: 0644
@ -66,7 +66,7 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure Matrix Appservice webhooks database.json template exists - name: Ensure Matrix Appservice webhooks database.json template exists
template: ansible.builtin.template:
src: "{{ role_path }}/templates/database.json.j2" src: "{{ role_path }}/templates/database.json.j2"
dest: "{{ matrix_appservice_webhooks_data_path }}/database.json" dest: "{{ matrix_appservice_webhooks_data_path }}/database.json"
mode: 0644 mode: 0644
@ -74,7 +74,7 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure appservice-webhooks registration.yaml installed - name: Ensure appservice-webhooks registration.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_appservice_webhooks_registration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_appservice_webhooks_registration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_appservice_webhooks_config_path }}/webhooks-registration.yaml" dest: "{{ matrix_appservice_webhooks_config_path }}/webhooks-registration.yaml"
mode: 0644 mode: 0644
@ -82,13 +82,13 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-appservice-webhooks.service installed - name: Ensure matrix-appservice-webhooks.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-appservice-webhooks.service.j2" src: "{{ role_path }}/templates/systemd/matrix-appservice-webhooks.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-appservice-webhooks.service" dest: "{{ matrix_systemd_path }}/matrix-appservice-webhooks.service"
mode: 0644 mode: 0644
register: matrix_appservice_webhooks_systemd_service_result register: matrix_appservice_webhooks_systemd_service_result
- name: Ensure systemd reloaded after matrix-appservice-webhooks.service installation - name: Ensure systemd reloaded after matrix-appservice-webhooks.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_appservice_webhooks_systemd_service_result.changed" when: "matrix_appservice_webhooks_systemd_service_result.changed"

View File

@ -6,7 +6,7 @@
register: matrix_appservice_webhooks_service_stat register: matrix_appservice_webhooks_service_stat
- name: Ensure matrix-appservice-webhooks is stopped - name: Ensure matrix-appservice-webhooks is stopped
service: ansible.builtin.service:
name: matrix-appservice-webhooks name: matrix-appservice-webhooks
state: stopped state: stopped
enabled: false enabled: false
@ -14,12 +14,12 @@
when: "matrix_appservice_webhooks_service_stat.stat.exists" when: "matrix_appservice_webhooks_service_stat.stat.exists"
- name: Ensure matrix-appservice-webhooks.service doesn't exist - name: Ensure matrix-appservice-webhooks.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-appservice-webhooks.service" path: "{{ matrix_systemd_path }}/matrix-appservice-webhooks.service"
state: absent state: absent
when: "matrix_appservice_webhooks_service_stat.stat.exists" when: "matrix_appservice_webhooks_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-appservice-webhooks.service removal - name: Ensure systemd reloaded after matrix-appservice-webhooks.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_appservice_webhooks_service_stat.stat.exists" when: "matrix_appservice_webhooks_service_stat.stat.exists"

View File

@ -1,7 +1,7 @@
--- ---
- name: Fail if required settings not defined - name: Fail if required settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"

View File

@ -1,11 +1,11 @@
--- ---
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-beeper-linkedin.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-beeper-linkedin.service'] }}"
when: matrix_beeper_linkedin_enabled|bool when: matrix_beeper_linkedin_enabled|bool
# If the matrix-synapse role is not used, these variables may not exist. # If the matrix-synapse role is not used, these variables may not exist.
- set_fact: - ansible.builtin.set_fact:
matrix_synapse_container_extra_arguments: > matrix_synapse_container_extra_arguments: >
{{ {{
matrix_synapse_container_extra_arguments|default([]) matrix_synapse_container_extra_arguments|default([])

View File

@ -3,12 +3,12 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases. # We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed - name: Fail if matrix-synapse role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
The matrix-bridge-beeper-linkedin role needs to execute before the matrix-synapse role. The matrix-bridge-beeper-linkedin role needs to execute before the matrix-synapse role.
when: "matrix_synapse_role_executed|default(False)" when: "matrix_synapse_role_executed|default(False)"
- name: Ensure Beeper LinkedIn paths exists - name: Ensure Beeper LinkedIn paths exists
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -36,7 +36,7 @@
- block: - block:
- name: Ensure Beeper LinkedIn repository is present on self-build - name: Ensure Beeper LinkedIn repository is present on self-build
git: ansible.builtin.git:
repo: "{{ matrix_beeper_linkedin_container_image_self_build_repo }}" repo: "{{ matrix_beeper_linkedin_container_image_self_build_repo }}"
dest: "{{ matrix_beeper_linkedin_docker_src_files_path }}" dest: "{{ matrix_beeper_linkedin_docker_src_files_path }}"
version: "{{ matrix_beeper_linkedin_container_image_self_build_branch }}" version: "{{ matrix_beeper_linkedin_container_image_self_build_branch }}"
@ -48,7 +48,7 @@
# Building the container image (using the default Dockerfile) requires that a docker-requirements.txt file be generated. # Building the container image (using the default Dockerfile) requires that a docker-requirements.txt file be generated.
# See: https://gitlab.com/beeper/linkedin/-/blob/94442db17ccb9769b377cdb8e4bf1cb3955781d7/.gitlab-ci.yml#L30-40 # See: https://gitlab.com/beeper/linkedin/-/blob/94442db17ccb9769b377cdb8e4bf1cb3955781d7/.gitlab-ci.yml#L30-40
- name: Ensure docker-requirements.txt is generated before building Beeper LinkedIn Docker Image - name: Ensure docker-requirements.txt is generated before building Beeper LinkedIn Docker Image
command: | ansible.builtin.command: |
{{ matrix_host_command_docker }} run \ {{ matrix_host_command_docker }} run \
--rm \ --rm \
--entrypoint=/bin/sh \ --entrypoint=/bin/sh \
@ -72,7 +72,7 @@
when: "matrix_beeper_linkedin_container_image_self_build|bool" when: "matrix_beeper_linkedin_container_image_self_build|bool"
- name: Ensure beeper-linkedin config.yaml installed - name: Ensure beeper-linkedin config.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_beeper_linkedin_configuration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_beeper_linkedin_configuration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_beeper_linkedin_config_path }}/config.yaml" dest: "{{ matrix_beeper_linkedin_config_path }}/config.yaml"
mode: 0644 mode: 0644
@ -80,7 +80,7 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure beeper-linkedin registration.yaml installed - name: Ensure beeper-linkedin registration.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_beeper_linkedin_registration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_beeper_linkedin_registration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_beeper_linkedin_config_path }}/registration.yaml" dest: "{{ matrix_beeper_linkedin_config_path }}/registration.yaml"
mode: 0644 mode: 0644
@ -88,13 +88,13 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-beeper-linkedin.service installed - name: Ensure matrix-beeper-linkedin.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-beeper-linkedin.service.j2" src: "{{ role_path }}/templates/systemd/matrix-beeper-linkedin.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-beeper-linkedin.service" dest: "{{ matrix_systemd_path }}/matrix-beeper-linkedin.service"
mode: 0644 mode: 0644
register: matrix_beeper_linkedin_systemd_service_result register: matrix_beeper_linkedin_systemd_service_result
- name: Ensure systemd reloaded after matrix-beeper-linkedin.service installation - name: Ensure systemd reloaded after matrix-beeper-linkedin.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_beeper_linkedin_systemd_service_result.changed" when: "matrix_beeper_linkedin_systemd_service_result.changed"

View File

@ -6,7 +6,7 @@
register: matrix_beeper_linkedin_service_stat register: matrix_beeper_linkedin_service_stat
- name: Ensure matrix-beeper-linkedin is stopped - name: Ensure matrix-beeper-linkedin is stopped
service: ansible.builtin.service:
name: matrix-beeper-linkedin name: matrix-beeper-linkedin
state: stopped state: stopped
enabled: false enabled: false
@ -14,12 +14,12 @@
when: "matrix_beeper_linkedin_service_stat.stat.exists" when: "matrix_beeper_linkedin_service_stat.stat.exists"
- name: Ensure matrix-beeper-linkedin.service doesn't exist - name: Ensure matrix-beeper-linkedin.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-beeper-linkedin.service" path: "{{ matrix_systemd_path }}/matrix-beeper-linkedin.service"
state: absent state: absent
when: "matrix_beeper_linkedin_service_stat.stat.exists" when: "matrix_beeper_linkedin_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-beeper-linkedin.service removal - name: Ensure systemd reloaded after matrix-beeper-linkedin.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_beeper_linkedin_service_stat.stat.exists" when: "matrix_beeper_linkedin_service_stat.stat.exists"

View File

@ -1,7 +1,7 @@
--- ---
- name: Fail if required settings not defined - name: Fail if required settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"

View File

@ -1,10 +1,10 @@
--- ---
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-go-skype-bridge.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-go-skype-bridge.service'] }}"
when: matrix_go_skype_bridge_enabled|bool when: matrix_go_skype_bridge_enabled|bool
# If the matrix-synapse role is not used, these variables may not exist. # If the matrix-synapse role is not used, these variables may not exist.
- set_fact: - ansible.builtin.set_fact:
matrix_synapse_container_extra_arguments: > matrix_synapse_container_extra_arguments: >
{{ {{
matrix_synapse_container_extra_arguments|default([]) matrix_synapse_container_extra_arguments|default([])

View File

@ -3,12 +3,12 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases. # We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed - name: Fail if matrix-synapse role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
The matrix-bridge-go-skype-bridge role needs to execute before the matrix-synapse role. The matrix-bridge-go-skype-bridge role needs to execute before the matrix-synapse role.
when: "matrix_synapse_role_executed|default(False)" when: "matrix_synapse_role_executed|default(False)"
- set_fact: - ansible.builtin.set_fact:
matrix_go_skype_bridge_requires_restart: false matrix_go_skype_bridge_requires_restart: false
- block: - block:
@ -18,7 +18,7 @@
register: matrix_go_skype_bridge_sqlite_database_path_local_stat_result register: matrix_go_skype_bridge_sqlite_database_path_local_stat_result
- block: - block:
- set_fact: - ansible.builtin.set_fact:
matrix_postgres_db_migration_request: matrix_postgres_db_migration_request:
src: "{{ matrix_go_skype_bridge_sqlite_database_path_local }}" src: "{{ matrix_go_skype_bridge_sqlite_database_path_local }}"
dst: "{{ matrix_go_skype_bridge_database_connection_string }}" dst: "{{ matrix_go_skype_bridge_database_connection_string }}"
@ -30,14 +30,14 @@
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
- set_fact: - ansible.builtin.set_fact:
matrix_go_skype_bridge_requires_restart: true matrix_go_skype_bridge_requires_restart: true
when: "matrix_go_skype_bridge_sqlite_database_path_local_stat_result.stat.exists|bool" when: "matrix_go_skype_bridge_sqlite_database_path_local_stat_result.stat.exists|bool"
when: "matrix_go_skype_bridge_database_engine == 'postgres'" when: "matrix_go_skype_bridge_database_engine == 'postgres'"
- name: Ensure Go Skype Bridge paths exists - name: Ensure Go Skype Bridge paths exists
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -63,7 +63,7 @@
until: result is not failed until: result is not failed
- name: Ensure Go Skype Bridge repository is present on self-build - name: Ensure Go Skype Bridge repository is present on self-build
git: ansible.builtin.git:
repo: "{{ matrix_go_skype_bridge_container_image_self_build_repo }}" repo: "{{ matrix_go_skype_bridge_container_image_self_build_repo }}"
dest: "{{ matrix_go_skype_bridge_docker_src_files_path }}" dest: "{{ matrix_go_skype_bridge_docker_src_files_path }}"
version: "{{ matrix_go_skype_bridge_container_image_self_build_branch }}" version: "{{ matrix_go_skype_bridge_container_image_self_build_branch }}"
@ -96,7 +96,7 @@
register: matrix_go_skype_bridge_stat_mx_state register: matrix_go_skype_bridge_stat_mx_state
- name: (Data relocation) Ensure matrix-go-skype-bridge.service is stopped - name: (Data relocation) Ensure matrix-go-skype-bridge.service is stopped
service: ansible.builtin.service:
name: matrix-go-skype-bridge name: matrix-go-skype-bridge
state: stopped state: stopped
enabled: false enabled: false
@ -105,15 +105,15 @@
when: "matrix_go_skype_bridge_stat_database.stat.exists" when: "matrix_go_skype_bridge_stat_database.stat.exists"
- name: (Data relocation) Move go-skype-bridge database file to ./data directory - name: (Data relocation) Move go-skype-bridge database file to ./data directory
command: "mv {{ matrix_go_skype_bridge_base_path }}/go-skype-bridge.db {{ matrix_go_skype_bridge_data_path }}/go-skype-bridge.db" ansible.builtin.command: "mv {{ matrix_go_skype_bridge_base_path }}/go-skype-bridge.db {{ matrix_go_skype_bridge_data_path }}/go-skype-bridge.db"
when: "matrix_go_skype_bridge_stat_database.stat.exists" when: "matrix_go_skype_bridge_stat_database.stat.exists"
- name: (Data relocation) Move go-skype-bridge mx-state file to ./data directory - name: (Data relocation) Move go-skype-bridge mx-state file to ./data directory
command: "mv {{ matrix_go_skype_bridge_base_path }}/mx-state.json {{ matrix_go_skype_bridge_data_path }}/mx-state.json" ansible.builtin.command: "mv {{ matrix_go_skype_bridge_base_path }}/mx-state.json {{ matrix_go_skype_bridge_data_path }}/mx-state.json"
when: "matrix_go_skype_bridge_stat_mx_state.stat.exists" when: "matrix_go_skype_bridge_stat_mx_state.stat.exists"
- name: Ensure go-skype-bridge config.yaml installed - name: Ensure go-skype-bridge config.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_go_skype_bridge_configuration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_go_skype_bridge_configuration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_go_skype_bridge_config_path }}/config.yaml" dest: "{{ matrix_go_skype_bridge_config_path }}/config.yaml"
mode: 0644 mode: 0644
@ -121,7 +121,7 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure go-skype-bridge registration.yaml installed - name: Ensure go-skype-bridge registration.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_go_skype_bridge_registration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_go_skype_bridge_registration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_go_skype_bridge_config_path }}/registration.yaml" dest: "{{ matrix_go_skype_bridge_config_path }}/registration.yaml"
mode: 0644 mode: 0644
@ -129,19 +129,19 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-go-skype-bridge.service installed - name: Ensure matrix-go-skype-bridge.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-go-skype-bridge.service.j2" src: "{{ role_path }}/templates/systemd/matrix-go-skype-bridge.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-go-skype-bridge.service" dest: "{{ matrix_systemd_path }}/matrix-go-skype-bridge.service"
mode: 0644 mode: 0644
register: matrix_go_skype_bridge_systemd_service_result register: matrix_go_skype_bridge_systemd_service_result
- name: Ensure systemd reloaded after matrix-go-skype-bridge.service installation - name: Ensure systemd reloaded after matrix-go-skype-bridge.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_go_skype_bridge_systemd_service_result.changed" when: "matrix_go_skype_bridge_systemd_service_result.changed"
- name: Ensure matrix-go-skype-bridge.service restarted, if necessary - name: Ensure matrix-go-skype-bridge.service restarted, if necessary
service: ansible.builtin.service:
name: "matrix-go-skype-bridge.service" name: "matrix-go-skype-bridge.service"
state: restarted state: restarted
when: "matrix_go_skype_bridge_requires_restart|bool" when: "matrix_go_skype_bridge_requires_restart|bool"

View File

@ -6,7 +6,7 @@
register: matrix_go_skype_bridge_service_stat register: matrix_go_skype_bridge_service_stat
- name: Ensure matrix-go-skype-bridge is stopped - name: Ensure matrix-go-skype-bridge is stopped
service: ansible.builtin.service:
name: matrix-go-skype-bridge name: matrix-go-skype-bridge
state: stopped state: stopped
enabled: false enabled: false
@ -14,12 +14,12 @@
when: "matrix_go_skype_bridge_service_stat.stat.exists" when: "matrix_go_skype_bridge_service_stat.stat.exists"
- name: Ensure matrix-go-skype-bridge.service doesn't exist - name: Ensure matrix-go-skype-bridge.service doesn't exist
file: ansible.builtin.file:
path: "/etc/systemd/system/matrix-go-skype-bridge.service" path: "/etc/systemd/system/matrix-go-skype-bridge.service"
state: absent state: absent
when: "matrix_go_skype_bridge_service_stat.stat.exists" when: "matrix_go_skype_bridge_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-go-skype-bridge.service removal - name: Ensure systemd reloaded after matrix-go-skype-bridge.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_go_skype_bridge_service_stat.stat.exists" when: "matrix_go_skype_bridge_service_stat.stat.exists"

View File

@ -1,7 +1,7 @@
--- ---
- name: Fail if required settings not defined - name: Fail if required settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"

View File

@ -2,17 +2,17 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases. # We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed - name: Fail if matrix-synapse role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
The matrix-bridge-heisenbridge role needs to execute before the matrix-synapse role. The matrix-bridge-heisenbridge role needs to execute before the matrix-synapse role.
when: "matrix_heisenbridge_enabled and matrix_synapse_role_executed|default(False)" when: "matrix_heisenbridge_enabled and matrix_synapse_role_executed|default(False)"
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-heisenbridge.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-heisenbridge.service'] }}"
when: matrix_heisenbridge_enabled|bool when: matrix_heisenbridge_enabled|bool
# If the matrix-synapse role is not used, these variables may not exist. # If the matrix-synapse role is not used, these variables may not exist.
- set_fact: - ansible.builtin.set_fact:
matrix_synapse_container_extra_arguments: > matrix_synapse_container_extra_arguments: >
{{ {{
matrix_synapse_container_extra_arguments|default([]) matrix_synapse_container_extra_arguments|default([])

View File

@ -12,7 +12,7 @@
until: result is not failed until: result is not failed
- name: Ensure heisenbridge paths exist - name: Ensure heisenbridge paths exist
file: ansible.builtin.file:
path: "{{ item }}" path: "{{ item }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -22,7 +22,7 @@
- "{{ matrix_heisenbridge_base_path }}" - "{{ matrix_heisenbridge_base_path }}"
- name: Ensure heisenbridge registration.yaml installed if provided - name: Ensure heisenbridge registration.yaml installed if provided
copy: ansible.builtin.copy:
content: "{{ matrix_heisenbridge_registration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_heisenbridge_registration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_heisenbridge_base_path }}/registration.yaml" dest: "{{ matrix_heisenbridge_base_path }}/registration.yaml"
mode: 0644 mode: 0644
@ -30,13 +30,13 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-heisenbridge.service installed - name: Ensure matrix-heisenbridge.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-heisenbridge.service.j2" src: "{{ role_path }}/templates/systemd/matrix-heisenbridge.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-heisenbridge.service" dest: "{{ matrix_systemd_path }}/matrix-heisenbridge.service"
mode: 0644 mode: 0644
register: matrix_heisenbridge_systemd_service_result register: matrix_heisenbridge_systemd_service_result
- name: Ensure systemd reloaded after matrix-heisenbridge.service installation - name: Ensure systemd reloaded after matrix-heisenbridge.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: matrix_heisenbridge_systemd_service_result.changed when: matrix_heisenbridge_systemd_service_result.changed

View File

@ -6,7 +6,7 @@
register: matrix_heisenbridge_service_stat register: matrix_heisenbridge_service_stat
- name: Ensure matrix-heisenbridge is stopped - name: Ensure matrix-heisenbridge is stopped
service: ansible.builtin.service:
name: matrix-heisenbridge name: matrix-heisenbridge
state: stopped state: stopped
enabled: false enabled: false
@ -14,12 +14,12 @@
when: "matrix_heisenbridge_service_stat.stat.exists" when: "matrix_heisenbridge_service_stat.stat.exists"
- name: Ensure matrix-heisenbridge.service doesn't exist - name: Ensure matrix-heisenbridge.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-heisenbridge.service" path: "{{ matrix_systemd_path }}/matrix-heisenbridge.service"
state: absent state: absent
when: "matrix_heisenbridge_service_stat.stat.exists" when: "matrix_heisenbridge_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-heisenbridge.service removal - name: Ensure systemd reloaded after matrix-heisenbridge.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_heisenbridge_service_stat.stat.exists" when: "matrix_heisenbridge_service_stat.stat.exists"

View File

@ -2,17 +2,17 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases. # We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed - name: Fail if matrix-synapse role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
The matrix-bridge-hookshot role needs to execute before the matrix-synapse role. The matrix-bridge-hookshot role needs to execute before the matrix-synapse role.
when: "matrix_hookshot_enabled and matrix_synapse_role_executed|default(False)" when: "matrix_hookshot_enabled and matrix_synapse_role_executed|default(False)"
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-hookshot.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-hookshot.service'] }}"
when: matrix_hookshot_enabled|bool when: matrix_hookshot_enabled|bool
# If the matrix-synapse role is not used, these variables may not exist. # If the matrix-synapse role is not used, these variables may not exist.
- set_fact: - ansible.builtin.set_fact:
matrix_synapse_container_extra_arguments: > matrix_synapse_container_extra_arguments: >
{{ {{
matrix_synapse_container_extra_arguments|default([]) matrix_synapse_container_extra_arguments|default([])
@ -30,7 +30,7 @@
- block: - block:
- name: Fail if matrix-nginx-proxy role already executed - name: Fail if matrix-nginx-proxy role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
Trying to append hookshot's reverse-proxying configuration to matrix-nginx-proxy, Trying to append hookshot's reverse-proxying configuration to matrix-nginx-proxy,
but it's pointless since the matrix-nginx-proxy role had already executed. but it's pointless since the matrix-nginx-proxy role had already executed.
@ -39,7 +39,7 @@
when: matrix_nginx_proxy_role_executed|default(False)|bool when: matrix_nginx_proxy_role_executed|default(False)|bool
- name: Generate Matrix hookshot proxying configuration for matrix-nginx-proxy - name: Generate Matrix hookshot proxying configuration for matrix-nginx-proxy
set_fact: ansible.builtin.set_fact:
matrix_hookshot_matrix_nginx_proxy_configuration: | matrix_hookshot_matrix_nginx_proxy_configuration: |
location ~ ^{{ matrix_hookshot_appservice_endpoint }}/(.*)$ { location ~ ^{{ matrix_hookshot_appservice_endpoint }}/(.*)$ {
{% if matrix_nginx_proxy_enabled|default(False) %} {% if matrix_nginx_proxy_enabled|default(False) %}
@ -95,7 +95,7 @@
} }
- name: Register hookshot proxying configuration with matrix-nginx-proxy - name: Register hookshot proxying configuration with matrix-nginx-proxy
set_fact: ansible.builtin.set_fact:
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
{{ {{
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([])
@ -104,7 +104,7 @@
}} }}
- name: Generate hookshot metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/hookshot) - name: Generate hookshot metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/hookshot)
set_fact: ansible.builtin.set_fact:
matrix_hookshot_matrix_nginx_proxy_metrics_configuration_matrix_domain: | matrix_hookshot_matrix_nginx_proxy_metrics_configuration_matrix_domain: |
location /metrics/hookshot { location /metrics/hookshot {
{% if matrix_nginx_proxy_enabled|default(False) %} {% if matrix_nginx_proxy_enabled|default(False) %}
@ -120,7 +120,7 @@
when: matrix_hookshot_metrics_enabled|bool and matrix_hookshot_metrics_proxying_enabled|bool when: matrix_hookshot_metrics_enabled|bool and matrix_hookshot_metrics_proxying_enabled|bool
- name: Register hookshot metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/hookshot) - name: Register hookshot metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/hookshot)
set_fact: ansible.builtin.set_fact:
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: | matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: |
{{ {{
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks|default([]) matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks|default([])
@ -131,7 +131,7 @@
when: matrix_hookshot_enabled|bool when: matrix_hookshot_enabled|bool
- name: Warn about reverse-proxying if matrix-nginx-proxy not used - name: Warn about reverse-proxying if matrix-nginx-proxy not used
debug: ansible.builtin.debug:
msg: >- msg: >-
NOTE: You've enabled the hookshot bridge but are not using the matrix-nginx-proxy NOTE: You've enabled the hookshot bridge but are not using the matrix-nginx-proxy
reverse proxy. reverse proxy.

View File

@ -3,7 +3,7 @@
- import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml" - import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml"
- name: Ensure hookshot paths exist - name: Ensure hookshot paths exist
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -27,7 +27,7 @@
until: result is not failed until: result is not failed
- name: Ensure hookshot repository is present on self-build - name: Ensure hookshot repository is present on self-build
git: ansible.builtin.git:
repo: "{{ matrix_hookshot_container_image_self_build_repo }}" repo: "{{ matrix_hookshot_container_image_self_build_repo }}"
dest: "{{ matrix_hookshot_docker_src_files_path }}" dest: "{{ matrix_hookshot_docker_src_files_path }}"
version: "{{ matrix_hookshot_container_image_self_build_branch }}" version: "{{ matrix_hookshot_container_image_self_build_branch }}"
@ -55,13 +55,13 @@
register: hookshot_passkey_file register: hookshot_passkey_file
- name: Generate hookshot passkey if it doesn't exist - name: Generate hookshot passkey if it doesn't exist
shell: "{{ matrix_host_command_openssl }} genpkey -out {{ matrix_hookshot_base_path }}/passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:4096" ansible.builtin.shell: "{{ matrix_host_command_openssl }} genpkey -out {{ matrix_hookshot_base_path }}/passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:4096"
become: true become: true
become_user: "{{ matrix_user_username }}" become_user: "{{ matrix_user_username }}"
when: "not hookshot_passkey_file.stat.exists" when: "not hookshot_passkey_file.stat.exists"
- name: Ensure hookshot config.yml installed if provided - name: Ensure hookshot config.yml installed if provided
copy: ansible.builtin.copy:
content: "{{ matrix_hookshot_configuration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_hookshot_configuration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_hookshot_base_path }}/config.yml" dest: "{{ matrix_hookshot_base_path }}/config.yml"
mode: 0644 mode: 0644
@ -69,7 +69,7 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Validate hookshot config.yml - name: Validate hookshot config.yml
command: | ansible.builtin.command: |
{{ matrix_host_command_docker }} run {{ matrix_host_command_docker }} run
--rm --rm
--name={{ matrix_hookshot_container_url }}-validate --name={{ matrix_hookshot_container_url }}-validate
@ -80,12 +80,12 @@
register: hookshot_config_validation_result register: hookshot_config_validation_result
- name: Fail if hookshot config.yml invalid - name: Fail if hookshot config.yml invalid
fail: ansible.builtin.fail:
msg: "Your hookshot configuration did not pass validation:\n{{ hookshot_config_validation_result.stdout }}\n{{ hookshot_config_validation_result.stderr }}" msg: "Your hookshot configuration did not pass validation:\n{{ hookshot_config_validation_result.stdout }}\n{{ hookshot_config_validation_result.stderr }}"
when: "hookshot_config_validation_result.rc > 0" when: "hookshot_config_validation_result.rc > 0"
- name: Ensure hookshot registration.yml installed if provided - name: Ensure hookshot registration.yml installed if provided
copy: ansible.builtin.copy:
content: "{{ matrix_hookshot_registration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_hookshot_registration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_hookshot_base_path }}/registration.yml" dest: "{{ matrix_hookshot_base_path }}/registration.yml"
mode: 0644 mode: 0644
@ -93,7 +93,7 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure hookshot github private key file installed if github is enabled - name: Ensure hookshot github private key file installed if github is enabled
copy: ansible.builtin.copy:
content: "{{ matrix_hookshot_github_private_key }}" content: "{{ matrix_hookshot_github_private_key }}"
dest: "{{ matrix_hookshot_base_path }}/{{ matrix_hookshot_github_private_key_file }}" dest: "{{ matrix_hookshot_base_path }}/{{ matrix_hookshot_github_private_key_file }}"
mode: 0400 mode: 0400
@ -102,13 +102,13 @@
when: matrix_hookshot_github_enabled|bool and matrix_hookshot_github_private_key|length > 0 when: matrix_hookshot_github_enabled|bool and matrix_hookshot_github_private_key|length > 0
- name: Ensure matrix-hookshot.service installed - name: Ensure matrix-hookshot.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-hookshot.service.j2" src: "{{ role_path }}/templates/systemd/matrix-hookshot.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-hookshot.service" dest: "{{ matrix_systemd_path }}/matrix-hookshot.service"
mode: 0644 mode: 0644
register: matrix_hookshot_systemd_service_result register: matrix_hookshot_systemd_service_result
- name: Ensure systemd reloaded after matrix-hookshot.service installation - name: Ensure systemd reloaded after matrix-hookshot.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: matrix_hookshot_systemd_service_result.changed when: matrix_hookshot_systemd_service_result.changed

View File

@ -6,7 +6,7 @@
register: matrix_hookshot_service_stat register: matrix_hookshot_service_stat
- name: Ensure matrix-hookshot is stopped - name: Ensure matrix-hookshot is stopped
service: ansible.builtin.service:
name: matrix-hookshot name: matrix-hookshot
state: stopped state: stopped
enabled: false enabled: false
@ -14,12 +14,12 @@
when: "matrix_hookshot_service_stat.stat.exists" when: "matrix_hookshot_service_stat.stat.exists"
- name: Ensure matrix-hookshot.service doesn't exist - name: Ensure matrix-hookshot.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-hookshot.service" path: "{{ matrix_systemd_path }}/matrix-hookshot.service"
state: absent state: absent
when: "matrix_hookshot_service_stat.stat.exists" when: "matrix_hookshot_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-hookshot.service removal - name: Ensure systemd reloaded after matrix-hookshot.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_hookshot_service_stat.stat.exists" when: "matrix_hookshot_service_stat.stat.exists"

View File

@ -1,7 +1,7 @@
--- ---
- name: Fail if required settings not defined - name: Fail if required settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"
@ -10,7 +10,7 @@
- "matrix_hookshot_homeserver_token" - "matrix_hookshot_homeserver_token"
- name: Fail if required GitHub settings not defined - name: Fail if required GitHub settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`) to enable GitHub. You need to define a required configuration setting (`{{ item }}`) to enable GitHub.
when: "matrix_hookshot_github_enabled and vars[item] == ''" when: "matrix_hookshot_github_enabled and vars[item] == ''"
@ -19,7 +19,7 @@
- "matrix_hookshot_github_secret" - "matrix_hookshot_github_secret"
- name: Fail if required GitHub OAuth settings not defined - name: Fail if required GitHub OAuth settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`) to enable GitHub OAuth. You need to define a required configuration setting (`{{ item }}`) to enable GitHub OAuth.
when: "matrix_hookshot_github_oauth_enabled and vars[item] == ''" when: "matrix_hookshot_github_oauth_enabled and vars[item] == ''"
@ -28,7 +28,7 @@
- "matrix_hookshot_github_oauth_secret" - "matrix_hookshot_github_oauth_secret"
- name: Fail if required Jira settings not defined - name: Fail if required Jira settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`) to enable Jira. You need to define a required configuration setting (`{{ item }}`) to enable Jira.
when: "matrix_hookshot_jira_enabled and vars[item] == ''" when: "matrix_hookshot_jira_enabled and vars[item] == ''"
@ -36,7 +36,7 @@
- "matrix_hookshot_jira_secret" - "matrix_hookshot_jira_secret"
- name: Fail if required Jira OAuth settings not defined - name: Fail if required Jira OAuth settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`) to enable Jira OAuth. You need to define a required configuration setting (`{{ item }}`) to enable Jira OAuth.
when: "matrix_hookshot_jira_oauth_enabled and vars[item] == ''" when: "matrix_hookshot_jira_oauth_enabled and vars[item] == ''"
@ -45,13 +45,13 @@
- "matrix_hookshot_jira_oauth_secret" - "matrix_hookshot_jira_oauth_secret"
- name: Fail if required Figma settings not defined - name: Fail if required Figma settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define at least one Figma instance to enable Figma. You need to define at least one Figma instance to enable Figma.
when: "matrix_hookshot_figma_enabled and matrix_hookshot_figma_instances is undefined" when: "matrix_hookshot_figma_enabled and matrix_hookshot_figma_instances is undefined"
- name: Fail if required provisioning settings not defined - name: Fail if required provisioning settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`) to enable provisioning. You need to define a required configuration setting (`{{ item }}`) to enable provisioning.
when: "matrix_hookshot_provisioning_enabled and vars[item] == ''" when: "matrix_hookshot_provisioning_enabled and vars[item] == ''"
@ -59,7 +59,7 @@
- "matrix_hookshot_provisioning_secret" - "matrix_hookshot_provisioning_secret"
- name: (Deprecation) Catch and report old metrics usage - name: (Deprecation) Catch and report old metrics usage
fail: ansible.builtin.fail:
msg: >- msg: >-
Your configuration contains a variable (`{{ item }}`), which refers to the old metrics collection system for Hookshot, Your configuration contains a variable (`{{ item }}`), which refers to the old metrics collection system for Hookshot,
which exposed metrics on `https://stats.DOMAIN/hookshot/metrics`. which exposed metrics on `https://stats.DOMAIN/hookshot/metrics`.

View File

@ -2,16 +2,16 @@
# See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070
# and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407
- name: Fail if trying to self-build on Ansible < 2.8 - name: Fail if trying to self-build on Ansible < 2.8
fail: ansible.builtin.fail:
msg: "To self-build the Element image, you should use Ansible 2.8 or higher. See docs/ansible.md" msg: "To self-build the Element image, you should use Ansible 2.8 or higher. See docs/ansible.md"
when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_facebook_container_image_self_build and matrix_mautrix_facebook_enabled" when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_facebook_container_image_self_build and matrix_mautrix_facebook_enabled"
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-facebook.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-facebook.service'] }}"
when: matrix_mautrix_facebook_enabled|bool when: matrix_mautrix_facebook_enabled|bool
# If the matrix-synapse role is not used, these variables may not exist. # If the matrix-synapse role is not used, these variables may not exist.
- set_fact: - ansible.builtin.set_fact:
matrix_synapse_container_extra_arguments: > matrix_synapse_container_extra_arguments: >
{{ {{
matrix_synapse_container_extra_arguments|default([]) matrix_synapse_container_extra_arguments|default([])
@ -29,7 +29,7 @@
- block: - block:
- name: Fail if matrix-nginx-proxy role already executed - name: Fail if matrix-nginx-proxy role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
Trying to append Mautrix Facebook's reverse-proxying configuration to matrix-nginx-proxy, Trying to append Mautrix Facebook's reverse-proxying configuration to matrix-nginx-proxy,
but it's pointless since the matrix-nginx-proxy role had already executed. but it's pointless since the matrix-nginx-proxy role had already executed.
@ -38,7 +38,7 @@
when: matrix_nginx_proxy_role_executed|default(False)|bool when: matrix_nginx_proxy_role_executed|default(False)|bool
- name: Generate Mautrix Facebook proxying configuration for matrix-nginx-proxy - name: Generate Mautrix Facebook proxying configuration for matrix-nginx-proxy
set_fact: ansible.builtin.set_fact:
matrix_mautrix_facebook_matrix_nginx_proxy_configuration: | matrix_mautrix_facebook_matrix_nginx_proxy_configuration: |
location {{ matrix_mautrix_facebook_public_endpoint }} { location {{ matrix_mautrix_facebook_public_endpoint }} {
{% if matrix_nginx_proxy_enabled|default(False) %} {% if matrix_nginx_proxy_enabled|default(False) %}
@ -53,7 +53,7 @@
} }
- name: Register Mautrix Facebook proxying configuration with matrix-nginx-proxy - name: Register Mautrix Facebook proxying configuration with matrix-nginx-proxy
set_fact: ansible.builtin.set_fact:
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
{{ {{
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([])
@ -62,7 +62,7 @@
}} }}
- name: Warn about reverse-proxying if matrix-nginx-proxy not used - name: Warn about reverse-proxying if matrix-nginx-proxy not used
debug: ansible.builtin.debug:
msg: >- msg: >-
NOTE: You've enabled the Mautrix Facebook bridge but are not using the matrix-nginx-proxy NOTE: You've enabled the Mautrix Facebook bridge but are not using the matrix-nginx-proxy
reverse proxy. reverse proxy.

View File

@ -3,12 +3,12 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases. # We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed - name: Fail if matrix-synapse role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
The matrix-bridge-mautrix-facebook role needs to execute before the matrix-synapse role. The matrix-bridge-mautrix-facebook role needs to execute before the matrix-synapse role.
when: "matrix_synapse_role_executed|default(False)" when: "matrix_synapse_role_executed|default(False)"
- set_fact: - ansible.builtin.set_fact:
matrix_mautrix_facebook_requires_restart: false matrix_mautrix_facebook_requires_restart: false
- block: - block:
@ -18,7 +18,7 @@
register: matrix_mautrix_facebook_sqlite_database_path_local_stat_result register: matrix_mautrix_facebook_sqlite_database_path_local_stat_result
- block: - block:
- set_fact: - ansible.builtin.set_fact:
matrix_postgres_db_migration_request: matrix_postgres_db_migration_request:
src: "{{ matrix_mautrix_facebook_sqlite_database_path_local }}" src: "{{ matrix_mautrix_facebook_sqlite_database_path_local }}"
dst: "{{ matrix_mautrix_facebook_database_connection_string }}" dst: "{{ matrix_mautrix_facebook_database_connection_string }}"
@ -29,7 +29,7 @@
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
- set_fact: - ansible.builtin.set_fact:
matrix_mautrix_facebook_requires_restart: true matrix_mautrix_facebook_requires_restart: true
when: "matrix_mautrix_facebook_sqlite_database_path_local_stat_result.stat.exists|bool" when: "matrix_mautrix_facebook_sqlite_database_path_local_stat_result.stat.exists|bool"
when: "matrix_mautrix_facebook_database_engine == 'postgres'" when: "matrix_mautrix_facebook_database_engine == 'postgres'"
@ -47,7 +47,7 @@
until: result is not failed until: result is not failed
- name: Ensure Mautrix Facebook paths exist - name: Ensure Mautrix Facebook paths exist
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -61,7 +61,7 @@
when: item.when|bool when: item.when|bool
- name: Ensure Mautrix Facebook repository is present on self-build - name: Ensure Mautrix Facebook repository is present on self-build
git: ansible.builtin.git:
repo: "{{ matrix_mautrix_facebook_container_image_self_build_repo }}" repo: "{{ matrix_mautrix_facebook_container_image_self_build_repo }}"
dest: "{{ matrix_mautrix_facebook_docker_src_files_path }}" dest: "{{ matrix_mautrix_facebook_docker_src_files_path }}"
version: "{{ matrix_mautrix_facebook_docker_image.split(':')[1] }}" version: "{{ matrix_mautrix_facebook_docker_image.split(':')[1] }}"
@ -89,7 +89,7 @@
register: matrix_mautrix_facebook_stat_database register: matrix_mautrix_facebook_stat_database
- name: (Data relocation) Ensure matrix-mautrix-facebook.service is stopped - name: (Data relocation) Ensure matrix-mautrix-facebook.service is stopped
service: ansible.builtin.service:
name: matrix-mautrix-facebook name: matrix-mautrix-facebook
state: stopped state: stopped
enabled: false enabled: false
@ -98,11 +98,11 @@
when: "matrix_mautrix_facebook_stat_database.stat.exists" when: "matrix_mautrix_facebook_stat_database.stat.exists"
- name: (Data relocation) Move mautrix-facebook database file to ./data directory - name: (Data relocation) Move mautrix-facebook database file to ./data directory
command: "mv {{ matrix_mautrix_facebook_base_path }}/mautrix-facebook.db {{ matrix_mautrix_facebook_data_path }}/mautrix-facebook.db" ansible.builtin.command: "mv {{ matrix_mautrix_facebook_base_path }}/mautrix-facebook.db {{ matrix_mautrix_facebook_data_path }}/mautrix-facebook.db"
when: "matrix_mautrix_facebook_stat_database.stat.exists" when: "matrix_mautrix_facebook_stat_database.stat.exists"
- name: Ensure mautrix-facebook config.yaml installed - name: Ensure mautrix-facebook config.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_mautrix_facebook_configuration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_mautrix_facebook_configuration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_mautrix_facebook_config_path }}/config.yaml" dest: "{{ matrix_mautrix_facebook_config_path }}/config.yaml"
mode: 0644 mode: 0644
@ -110,7 +110,7 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure mautrix-facebook registration.yaml installed - name: Ensure mautrix-facebook registration.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_mautrix_facebook_registration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_mautrix_facebook_registration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_mautrix_facebook_config_path }}/registration.yaml" dest: "{{ matrix_mautrix_facebook_config_path }}/registration.yaml"
mode: 0644 mode: 0644
@ -118,19 +118,19 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-mautrix-facebook.service installed - name: Ensure matrix-mautrix-facebook.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-mautrix-facebook.service.j2" src: "{{ role_path }}/templates/systemd/matrix-mautrix-facebook.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-mautrix-facebook.service" dest: "{{ matrix_systemd_path }}/matrix-mautrix-facebook.service"
mode: 0644 mode: 0644
register: matrix_mautrix_facebook_systemd_service_result register: matrix_mautrix_facebook_systemd_service_result
- name: Ensure systemd reloaded after matrix-mautrix-facebook.service installation - name: Ensure systemd reloaded after matrix-mautrix-facebook.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_mautrix_facebook_systemd_service_result.changed" when: "matrix_mautrix_facebook_systemd_service_result.changed"
- name: Ensure matrix-mautrix-facebook.service restarted, if necessary - name: Ensure matrix-mautrix-facebook.service restarted, if necessary
service: ansible.builtin.service:
name: "matrix-mautrix-facebook.service" name: "matrix-mautrix-facebook.service"
state: restarted state: restarted
when: "matrix_mautrix_facebook_requires_restart|bool" when: "matrix_mautrix_facebook_requires_restart|bool"

View File

@ -6,7 +6,7 @@
register: matrix_mautrix_facebook_service_stat register: matrix_mautrix_facebook_service_stat
- name: Ensure matrix-mautrix-facebook is stopped - name: Ensure matrix-mautrix-facebook is stopped
service: ansible.builtin.service:
name: matrix-mautrix-facebook name: matrix-mautrix-facebook
state: stopped state: stopped
enabled: false enabled: false
@ -14,12 +14,12 @@
when: "matrix_mautrix_facebook_service_stat.stat.exists" when: "matrix_mautrix_facebook_service_stat.stat.exists"
- name: Ensure matrix-mautrix-facebook.service doesn't exist - name: Ensure matrix-mautrix-facebook.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-mautrix-facebook.service" path: "{{ matrix_systemd_path }}/matrix-mautrix-facebook.service"
state: absent state: absent
when: "matrix_mautrix_facebook_service_stat.stat.exists" when: "matrix_mautrix_facebook_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-mautrix-facebook.service removal - name: Ensure systemd reloaded after matrix-mautrix-facebook.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_mautrix_facebook_service_stat.stat.exists" when: "matrix_mautrix_facebook_service_stat.stat.exists"

View File

@ -1,7 +1,7 @@
--- ---
- name: Fail if required settings not defined - name: Fail if required settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"
@ -12,7 +12,7 @@
- block: - block:
- name: Inject warning if on an old SQLite-supporting version - name: Inject warning if on an old SQLite-supporting version
set_fact: ansible.builtin.set_fact:
matrix_playbook_runtime_results: | matrix_playbook_runtime_results: |
{{ {{
matrix_playbook_runtime_results|default([]) matrix_playbook_runtime_results|default([])

View File

@ -2,16 +2,16 @@
# See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070
# and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407
- name: Fail if trying to self-build on Ansible < 2.8 - name: Fail if trying to self-build on Ansible < 2.8
fail: ansible.builtin.fail:
msg: "To self-build the Element image, you should use Ansible 2.8 or higher. See docs/ansible.md" msg: "To self-build the Element image, you should use Ansible 2.8 or higher. See docs/ansible.md"
when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_googlechat_container_image_self_build and matrix_mautrix_googlechat_enabled" when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_googlechat_container_image_self_build and matrix_mautrix_googlechat_enabled"
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-googlechat.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-googlechat.service'] }}"
when: matrix_mautrix_googlechat_enabled|bool when: matrix_mautrix_googlechat_enabled|bool
# If the matrix-synapse role is not used, these variables may not exist. # If the matrix-synapse role is not used, these variables may not exist.
- set_fact: - ansible.builtin.set_fact:
matrix_synapse_container_extra_arguments: > matrix_synapse_container_extra_arguments: >
{{ {{
matrix_synapse_container_extra_arguments|default([]) matrix_synapse_container_extra_arguments|default([])
@ -29,7 +29,7 @@
- block: - block:
- name: Fail if matrix-nginx-proxy role already executed - name: Fail if matrix-nginx-proxy role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
Trying to append Mautrix googlechat's reverse-proxying configuration to matrix-nginx-proxy, Trying to append Mautrix googlechat's reverse-proxying configuration to matrix-nginx-proxy,
but it's pointless since the matrix-nginx-proxy role had already executed. but it's pointless since the matrix-nginx-proxy role had already executed.
@ -38,7 +38,7 @@
when: matrix_nginx_proxy_role_executed|default(False)|bool when: matrix_nginx_proxy_role_executed|default(False)|bool
- name: Generate Mautrix googlechat proxying configuration for matrix-nginx-proxy - name: Generate Mautrix googlechat proxying configuration for matrix-nginx-proxy
set_fact: ansible.builtin.set_fact:
matrix_mautrix_googlechat_matrix_nginx_proxy_configuration: | matrix_mautrix_googlechat_matrix_nginx_proxy_configuration: |
location {{ matrix_mautrix_googlechat_public_endpoint }} { location {{ matrix_mautrix_googlechat_public_endpoint }} {
{% if matrix_nginx_proxy_enabled|default(False) %} {% if matrix_nginx_proxy_enabled|default(False) %}
@ -52,7 +52,7 @@
{% endif %} {% endif %}
} }
- name: Register Mautrix googlechat proxying configuration with matrix-nginx-proxy - name: Register Mautrix googlechat proxying configuration with matrix-nginx-proxy
set_fact: ansible.builtin.set_fact:
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
{{ {{
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([])
@ -64,7 +64,7 @@
when: matrix_mautrix_googlechat_enabled|bool when: matrix_mautrix_googlechat_enabled|bool
- name: Warn about reverse-proxying if matrix-nginx-proxy not used - name: Warn about reverse-proxying if matrix-nginx-proxy not used
debug: ansible.builtin.debug:
msg: >- msg: >-
NOTE: You've enabled the Mautrix googlechat bridge but are not using the matrix-nginx-proxy NOTE: You've enabled the Mautrix googlechat bridge but are not using the matrix-nginx-proxy
reverse proxy. reverse proxy.

View File

@ -3,12 +3,12 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases. # We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed - name: Fail if matrix-synapse role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
The matrix-bridge-mautrix-googlechat role needs to execute before the matrix-synapse role. The matrix-bridge-mautrix-googlechat role needs to execute before the matrix-synapse role.
when: "matrix_synapse_role_executed|default(False)" when: "matrix_synapse_role_executed|default(False)"
- set_fact: - ansible.builtin.set_fact:
matrix_mautrix_googlechat_requires_restart: false matrix_mautrix_googlechat_requires_restart: false
- block: - block:
@ -18,7 +18,7 @@
register: matrix_mautrix_googlechat_sqlite_database_path_local_stat_result register: matrix_mautrix_googlechat_sqlite_database_path_local_stat_result
- block: - block:
- set_fact: - ansible.builtin.set_fact:
matrix_postgres_db_migration_request: matrix_postgres_db_migration_request:
src: "{{ matrix_mautrix_googlechat_sqlite_database_path_local }}" src: "{{ matrix_mautrix_googlechat_sqlite_database_path_local }}"
dst: "{{ matrix_mautrix_googlechat_database_connection_string }}" dst: "{{ matrix_mautrix_googlechat_database_connection_string }}"
@ -29,7 +29,7 @@
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
- set_fact: - ansible.builtin.set_fact:
matrix_mautrix_googlechat_requires_restart: true matrix_mautrix_googlechat_requires_restart: true
when: "matrix_mautrix_googlechat_sqlite_database_path_local_stat_result.stat.exists|bool" when: "matrix_mautrix_googlechat_sqlite_database_path_local_stat_result.stat.exists|bool"
when: "matrix_mautrix_googlechat_database_engine == 'postgres'" when: "matrix_mautrix_googlechat_database_engine == 'postgres'"
@ -47,7 +47,7 @@
until: result is not failed until: result is not failed
- name: Ensure Mautrix googlechat paths exist - name: Ensure Mautrix googlechat paths exist
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -61,7 +61,7 @@
when: "item.when|bool" when: "item.when|bool"
- name: Ensure Mautrix Hangots repository is present on self build - name: Ensure Mautrix Hangots repository is present on self build
git: ansible.builtin.git:
repo: "{{ matrix_mautrix_googlechat_container_image_self_build_repo }}" repo: "{{ matrix_mautrix_googlechat_container_image_self_build_repo }}"
dest: "{{ matrix_mautrix_googlechat_docker_src_files_path }}" dest: "{{ matrix_mautrix_googlechat_docker_src_files_path }}"
force: "yes" force: "yes"
@ -88,7 +88,7 @@
register: matrix_mautrix_googlechat_stat_database register: matrix_mautrix_googlechat_stat_database
- name: (Data relocation) Ensure matrix-mautrix-googlechat.service is stopped - name: (Data relocation) Ensure matrix-mautrix-googlechat.service is stopped
service: ansible.builtin.service:
name: matrix-mautrix-googlechat name: matrix-mautrix-googlechat
state: stopped state: stopped
enabled: false enabled: false
@ -97,11 +97,11 @@
when: "matrix_mautrix_googlechat_stat_database.stat.exists" when: "matrix_mautrix_googlechat_stat_database.stat.exists"
- name: (Data relocation) Move mautrix-googlechat database file to ./data directory - name: (Data relocation) Move mautrix-googlechat database file to ./data directory
command: "mv {{ matrix_mautrix_googlechat_base_path }}/mautrix-googlechat.db {{ matrix_mautrix_googlechat_data_path }}/mautrix-googlechat.db" ansible.builtin.command: "mv {{ matrix_mautrix_googlechat_base_path }}/mautrix-googlechat.db {{ matrix_mautrix_googlechat_data_path }}/mautrix-googlechat.db"
when: "matrix_mautrix_googlechat_stat_database.stat.exists" when: "matrix_mautrix_googlechat_stat_database.stat.exists"
- name: Ensure mautrix-googlechat config.yaml installed - name: Ensure mautrix-googlechat config.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_mautrix_googlechat_configuration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_mautrix_googlechat_configuration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_mautrix_googlechat_config_path }}/config.yaml" dest: "{{ matrix_mautrix_googlechat_config_path }}/config.yaml"
mode: 0644 mode: 0644
@ -109,7 +109,7 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure mautrix-googlechat registration.yaml installed - name: Ensure mautrix-googlechat registration.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_mautrix_googlechat_registration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_mautrix_googlechat_registration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_mautrix_googlechat_config_path }}/registration.yaml" dest: "{{ matrix_mautrix_googlechat_config_path }}/registration.yaml"
mode: 0644 mode: 0644
@ -117,19 +117,19 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-mautrix-googlechat.service installed - name: Ensure matrix-mautrix-googlechat.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-mautrix-googlechat.service.j2" src: "{{ role_path }}/templates/systemd/matrix-mautrix-googlechat.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-mautrix-googlechat.service" dest: "{{ matrix_systemd_path }}/matrix-mautrix-googlechat.service"
mode: 0644 mode: 0644
register: matrix_mautrix_googlechat_systemd_service_result register: matrix_mautrix_googlechat_systemd_service_result
- name: Ensure systemd reloaded after matrix-mautrix-googlechat.service installation - name: Ensure systemd reloaded after matrix-mautrix-googlechat.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_mautrix_googlechat_systemd_service_result.changed" when: "matrix_mautrix_googlechat_systemd_service_result.changed"
- name: Ensure matrix-mautrix-googlechat.service restarted, if necessary - name: Ensure matrix-mautrix-googlechat.service restarted, if necessary
service: ansible.builtin.service:
name: "matrix-mautrix-googlechat.service" name: "matrix-mautrix-googlechat.service"
state: restarted state: restarted
when: "matrix_mautrix_googlechat_requires_restart|bool" when: "matrix_mautrix_googlechat_requires_restart|bool"

View File

@ -6,7 +6,7 @@
register: matrix_mautrix_googlechat_service_stat register: matrix_mautrix_googlechat_service_stat
- name: Ensure matrix-mautrix-googlechat is stopped - name: Ensure matrix-mautrix-googlechat is stopped
service: ansible.builtin.service:
name: matrix-mautrix-googlechat name: matrix-mautrix-googlechat
state: stopped state: stopped
enabled: false enabled: false
@ -14,12 +14,12 @@
when: "matrix_mautrix_googlechat_service_stat.stat.exists" when: "matrix_mautrix_googlechat_service_stat.stat.exists"
- name: Ensure matrix-mautrix-googlechat.service doesn't exist - name: Ensure matrix-mautrix-googlechat.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-mautrix-googlechat.service" path: "{{ matrix_systemd_path }}/matrix-mautrix-googlechat.service"
state: absent state: absent
when: "matrix_mautrix_googlechat_service_stat.stat.exists" when: "matrix_mautrix_googlechat_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-mautrix-googlechat.service removal - name: Ensure systemd reloaded after matrix-mautrix-googlechat.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_mautrix_googlechat_service_stat.stat.exists" when: "matrix_mautrix_googlechat_service_stat.stat.exists"

View File

@ -1,7 +1,7 @@
--- ---
- name: Fail if required settings not defined - name: Fail if required settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"
@ -9,6 +9,6 @@
- "matrix_mautrix_googlechat_public_endpoint" - "matrix_mautrix_googlechat_public_endpoint"
- "matrix_mautrix_googlechat_appservice_token" - "matrix_mautrix_googlechat_appservice_token"
- "matrix_mautrix_googlechat_homeserver_token" - "matrix_mautrix_googlechat_homeserver_token"
- debug: - ansible.builtin.debug:
msg: msg:
- '`matrix_mautrix_googlechat_homeserver_domain` == {{ matrix_mautrix_googlechat_homeserver_domain }}' - '`matrix_mautrix_googlechat_homeserver_domain` == {{ matrix_mautrix_googlechat_homeserver_domain }}'

View File

@ -2,16 +2,16 @@
# See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070
# and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407
- name: Fail if trying to self-build on Ansible < 2.8 - name: Fail if trying to self-build on Ansible < 2.8
fail: ansible.builtin.fail:
msg: "To self-build the Element image, you should use Ansible 2.8 or higher. See docs/ansible.md" msg: "To self-build the Element image, you should use Ansible 2.8 or higher. See docs/ansible.md"
when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_hangouts_container_image_self_build and matrix_mautrix_hangouts_enabled" when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_hangouts_container_image_self_build and matrix_mautrix_hangouts_enabled"
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-hangouts.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-hangouts.service'] }}"
when: matrix_mautrix_hangouts_enabled|bool when: matrix_mautrix_hangouts_enabled|bool
# If the matrix-synapse role is not used, these variables may not exist. # If the matrix-synapse role is not used, these variables may not exist.
- set_fact: - ansible.builtin.set_fact:
matrix_synapse_container_extra_arguments: > matrix_synapse_container_extra_arguments: >
{{ {{
matrix_synapse_container_extra_arguments|default([]) matrix_synapse_container_extra_arguments|default([])
@ -29,7 +29,7 @@
- block: - block:
- name: Fail if matrix-nginx-proxy role already executed - name: Fail if matrix-nginx-proxy role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
Trying to append Mautrix Hangouts's reverse-proxying configuration to matrix-nginx-proxy, Trying to append Mautrix Hangouts's reverse-proxying configuration to matrix-nginx-proxy,
but it's pointless since the matrix-nginx-proxy role had already executed. but it's pointless since the matrix-nginx-proxy role had already executed.
@ -38,7 +38,7 @@
when: matrix_nginx_proxy_role_executed|default(False)|bool when: matrix_nginx_proxy_role_executed|default(False)|bool
- name: Generate Mautrix Hangouts proxying configuration for matrix-nginx-proxy - name: Generate Mautrix Hangouts proxying configuration for matrix-nginx-proxy
set_fact: ansible.builtin.set_fact:
matrix_mautrix_hangouts_matrix_nginx_proxy_configuration: | matrix_mautrix_hangouts_matrix_nginx_proxy_configuration: |
location {{ matrix_mautrix_hangouts_public_endpoint }} { location {{ matrix_mautrix_hangouts_public_endpoint }} {
{% if matrix_nginx_proxy_enabled|default(False) %} {% if matrix_nginx_proxy_enabled|default(False) %}
@ -52,7 +52,7 @@
{% endif %} {% endif %}
} }
- name: Register Mautrix Hangouts proxying configuration with matrix-nginx-proxy - name: Register Mautrix Hangouts proxying configuration with matrix-nginx-proxy
set_fact: ansible.builtin.set_fact:
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
{{ {{
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([])
@ -64,7 +64,7 @@
when: matrix_mautrix_hangouts_enabled|bool when: matrix_mautrix_hangouts_enabled|bool
- name: Warn about reverse-proxying if matrix-nginx-proxy not used - name: Warn about reverse-proxying if matrix-nginx-proxy not used
debug: ansible.builtin.debug:
msg: >- msg: >-
NOTE: You've enabled the Mautrix Hangouts bridge but are not using the matrix-nginx-proxy NOTE: You've enabled the Mautrix Hangouts bridge but are not using the matrix-nginx-proxy
reverse proxy. reverse proxy.

View File

@ -3,12 +3,12 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases. # We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed - name: Fail if matrix-synapse role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
The matrix-bridge-mautrix-hangouts role needs to execute before the matrix-synapse role. The matrix-bridge-mautrix-hangouts role needs to execute before the matrix-synapse role.
when: "matrix_synapse_role_executed|default(False)" when: "matrix_synapse_role_executed|default(False)"
- set_fact: - ansible.builtin.set_fact:
matrix_mautrix_hangouts_requires_restart: false matrix_mautrix_hangouts_requires_restart: false
- block: - block:
@ -18,7 +18,7 @@
register: matrix_mautrix_hangouts_sqlite_database_path_local_stat_result register: matrix_mautrix_hangouts_sqlite_database_path_local_stat_result
- block: - block:
- set_fact: - ansible.builtin.set_fact:
matrix_postgres_db_migration_request: matrix_postgres_db_migration_request:
src: "{{ matrix_mautrix_hangouts_sqlite_database_path_local }}" src: "{{ matrix_mautrix_hangouts_sqlite_database_path_local }}"
dst: "{{ matrix_mautrix_hangouts_database_connection_string }}" dst: "{{ matrix_mautrix_hangouts_database_connection_string }}"
@ -29,7 +29,7 @@
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
- set_fact: - ansible.builtin.set_fact:
matrix_mautrix_hangouts_requires_restart: true matrix_mautrix_hangouts_requires_restart: true
when: "matrix_mautrix_hangouts_sqlite_database_path_local_stat_result.stat.exists|bool" when: "matrix_mautrix_hangouts_sqlite_database_path_local_stat_result.stat.exists|bool"
when: "matrix_mautrix_hangouts_database_engine == 'postgres'" when: "matrix_mautrix_hangouts_database_engine == 'postgres'"
@ -47,7 +47,7 @@
until: result is not failed until: result is not failed
- name: Ensure Mautrix Hangouts paths exist - name: Ensure Mautrix Hangouts paths exist
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -61,7 +61,7 @@
when: "item.when|bool" when: "item.when|bool"
- name: Ensure Mautrix Hangots repository is present on self build - name: Ensure Mautrix Hangots repository is present on self build
git: ansible.builtin.git:
repo: "{{ matrix_mautrix_hangouts_container_image_self_build_repo }}" repo: "{{ matrix_mautrix_hangouts_container_image_self_build_repo }}"
dest: "{{ matrix_mautrix_hangouts_docker_src_files_path }}" dest: "{{ matrix_mautrix_hangouts_docker_src_files_path }}"
force: "yes" force: "yes"
@ -88,7 +88,7 @@
register: matrix_mautrix_hangouts_stat_database register: matrix_mautrix_hangouts_stat_database
- name: (Data relocation) Ensure matrix-mautrix-hangouts.service is stopped - name: (Data relocation) Ensure matrix-mautrix-hangouts.service is stopped
service: ansible.builtin.service:
name: matrix-mautrix-hangouts name: matrix-mautrix-hangouts
state: stopped state: stopped
enabled: false enabled: false
@ -97,11 +97,11 @@
when: "matrix_mautrix_hangouts_stat_database.stat.exists" when: "matrix_mautrix_hangouts_stat_database.stat.exists"
- name: (Data relocation) Move mautrix-hangouts database file to ./data directory - name: (Data relocation) Move mautrix-hangouts database file to ./data directory
command: "mv {{ matrix_mautrix_hangouts_base_path }}/mautrix-hangouts.db {{ matrix_mautrix_hangouts_data_path }}/mautrix-hangouts.db" ansible.builtin.command: "mv {{ matrix_mautrix_hangouts_base_path }}/mautrix-hangouts.db {{ matrix_mautrix_hangouts_data_path }}/mautrix-hangouts.db"
when: "matrix_mautrix_hangouts_stat_database.stat.exists" when: "matrix_mautrix_hangouts_stat_database.stat.exists"
- name: Ensure mautrix-hangouts config.yaml installed - name: Ensure mautrix-hangouts config.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_mautrix_hangouts_configuration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_mautrix_hangouts_configuration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_mautrix_hangouts_config_path }}/config.yaml" dest: "{{ matrix_mautrix_hangouts_config_path }}/config.yaml"
mode: 0644 mode: 0644
@ -109,7 +109,7 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure mautrix-hangouts registration.yaml installed - name: Ensure mautrix-hangouts registration.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_mautrix_hangouts_registration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_mautrix_hangouts_registration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_mautrix_hangouts_config_path }}/registration.yaml" dest: "{{ matrix_mautrix_hangouts_config_path }}/registration.yaml"
mode: 0644 mode: 0644
@ -117,19 +117,19 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-mautrix-hangouts.service installed - name: Ensure matrix-mautrix-hangouts.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-mautrix-hangouts.service.j2" src: "{{ role_path }}/templates/systemd/matrix-mautrix-hangouts.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-mautrix-hangouts.service" dest: "{{ matrix_systemd_path }}/matrix-mautrix-hangouts.service"
mode: 0644 mode: 0644
register: matrix_mautrix_hangouts_systemd_service_result register: matrix_mautrix_hangouts_systemd_service_result
- name: Ensure systemd reloaded after matrix-mautrix-hangouts.service installation - name: Ensure systemd reloaded after matrix-mautrix-hangouts.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_mautrix_hangouts_systemd_service_result.changed" when: "matrix_mautrix_hangouts_systemd_service_result.changed"
- name: Ensure matrix-mautrix-hangouts.service restarted, if necessary - name: Ensure matrix-mautrix-hangouts.service restarted, if necessary
service: ansible.builtin.service:
name: "matrix-mautrix-hangouts.service" name: "matrix-mautrix-hangouts.service"
state: restarted state: restarted
when: "matrix_mautrix_hangouts_requires_restart|bool" when: "matrix_mautrix_hangouts_requires_restart|bool"

View File

@ -6,7 +6,7 @@
register: matrix_mautrix_hangouts_service_stat register: matrix_mautrix_hangouts_service_stat
- name: Ensure matrix-mautrix-hangouts is stopped - name: Ensure matrix-mautrix-hangouts is stopped
service: ansible.builtin.service:
name: matrix-mautrix-hangouts name: matrix-mautrix-hangouts
state: stopped state: stopped
enabled: false enabled: false
@ -14,12 +14,12 @@
when: "matrix_mautrix_hangouts_service_stat.stat.exists" when: "matrix_mautrix_hangouts_service_stat.stat.exists"
- name: Ensure matrix-mautrix-hangouts.service doesn't exist - name: Ensure matrix-mautrix-hangouts.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-mautrix-hangouts.service" path: "{{ matrix_systemd_path }}/matrix-mautrix-hangouts.service"
state: absent state: absent
when: "matrix_mautrix_hangouts_service_stat.stat.exists" when: "matrix_mautrix_hangouts_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-mautrix-hangouts.service removal - name: Ensure systemd reloaded after matrix-mautrix-hangouts.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_mautrix_hangouts_service_stat.stat.exists" when: "matrix_mautrix_hangouts_service_stat.stat.exists"

View File

@ -1,7 +1,7 @@
--- ---
- name: Fail if required settings not defined - name: Fail if required settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"
@ -9,6 +9,6 @@
- "matrix_mautrix_hangouts_public_endpoint" - "matrix_mautrix_hangouts_public_endpoint"
- "matrix_mautrix_hangouts_appservice_token" - "matrix_mautrix_hangouts_appservice_token"
- "matrix_mautrix_hangouts_homeserver_token" - "matrix_mautrix_hangouts_homeserver_token"
- debug: - ansible.builtin.debug:
msg: msg:
- '`matrix_mautrix_hangouts_homeserver_domain` == {{ matrix_mautrix_hangouts_homeserver_domain }}' - '`matrix_mautrix_hangouts_homeserver_domain` == {{ matrix_mautrix_hangouts_homeserver_domain }}'

View File

@ -2,16 +2,16 @@
# See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070
# and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407
- name: Fail if trying to self-build on Ansible < 2.8 - name: Fail if trying to self-build on Ansible < 2.8
fail: ansible.builtin.fail:
msg: "To self-build the Element image, you should use Ansible 2.8 or higher. See docs/ansible.md" msg: "To self-build the Element image, you should use Ansible 2.8 or higher. See docs/ansible.md"
when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_instagram_container_image_self_build and matrix_mautrix_instagram_enabled" when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_instagram_container_image_self_build and matrix_mautrix_instagram_enabled"
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-instagram.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-instagram.service'] }}"
when: matrix_mautrix_instagram_enabled|bool when: matrix_mautrix_instagram_enabled|bool
# If the matrix-synapse role is not used, these variables may not exist. # If the matrix-synapse role is not used, these variables may not exist.
- set_fact: - ansible.builtin.set_fact:
matrix_synapse_container_extra_arguments: > matrix_synapse_container_extra_arguments: >
{{ {{
matrix_synapse_container_extra_arguments|default([]) matrix_synapse_container_extra_arguments|default([])

View File

@ -2,7 +2,7 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases. # We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed - name: Fail if matrix-synapse role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
The matrix-bridge-mautrix-instagram role needs to execute before the matrix-synapse role. The matrix-bridge-mautrix-instagram role needs to execute before the matrix-synapse role.
when: "matrix_synapse_role_executed|default(False)" when: "matrix_synapse_role_executed|default(False)"
@ -20,7 +20,7 @@
until: result is not failed until: result is not failed
- name: Ensure Mautrix instagram paths exist - name: Ensure Mautrix instagram paths exist
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -34,7 +34,7 @@
when: item.when|bool when: item.when|bool
- name: Ensure Mautrix instagram repository is present on self-build - name: Ensure Mautrix instagram repository is present on self-build
git: ansible.builtin.git:
repo: "{{ matrix_mautrix_instagram_container_image_self_build_repo }}" repo: "{{ matrix_mautrix_instagram_container_image_self_build_repo }}"
dest: "{{ matrix_mautrix_instagram_docker_src_files_path }}" dest: "{{ matrix_mautrix_instagram_docker_src_files_path }}"
force: "yes" force: "yes"
@ -56,7 +56,7 @@
when: "matrix_mautrix_instagram_container_image_self_build|bool" when: "matrix_mautrix_instagram_container_image_self_build|bool"
- name: Ensure mautrix-instagram config.yaml installed - name: Ensure mautrix-instagram config.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_mautrix_instagram_configuration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_mautrix_instagram_configuration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_mautrix_instagram_config_path }}/config.yaml" dest: "{{ matrix_mautrix_instagram_config_path }}/config.yaml"
mode: 0644 mode: 0644
@ -64,7 +64,7 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure mautrix-instagram registration.yaml installed - name: Ensure mautrix-instagram registration.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_mautrix_instagram_registration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_mautrix_instagram_registration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_mautrix_instagram_config_path }}/registration.yaml" dest: "{{ matrix_mautrix_instagram_config_path }}/registration.yaml"
mode: 0644 mode: 0644
@ -72,13 +72,13 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-mautrix-instagram.service installed - name: Ensure matrix-mautrix-instagram.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-mautrix-instagram.service.j2" src: "{{ role_path }}/templates/systemd/matrix-mautrix-instagram.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-mautrix-instagram.service" dest: "{{ matrix_systemd_path }}/matrix-mautrix-instagram.service"
mode: 0644 mode: 0644
register: matrix_mautrix_instagram_systemd_service_result register: matrix_mautrix_instagram_systemd_service_result
- name: Ensure systemd reloaded after matrix-mautrix-instagram.service installation - name: Ensure systemd reloaded after matrix-mautrix-instagram.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_mautrix_instagram_systemd_service_result.changed" when: "matrix_mautrix_instagram_systemd_service_result.changed"

View File

@ -5,7 +5,7 @@
register: matrix_mautrix_instagram_service_stat register: matrix_mautrix_instagram_service_stat
- name: Ensure matrix-mautrix-instagram is stopped - name: Ensure matrix-mautrix-instagram is stopped
service: ansible.builtin.service:
name: matrix-mautrix-instagram name: matrix-mautrix-instagram
state: stopped state: stopped
enabled: false enabled: false
@ -13,12 +13,12 @@
when: "matrix_mautrix_instagram_service_stat.stat.exists" when: "matrix_mautrix_instagram_service_stat.stat.exists"
- name: Ensure matrix-mautrix-instagram.service doesn't exist - name: Ensure matrix-mautrix-instagram.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-mautrix-instagram.service" path: "{{ matrix_systemd_path }}/matrix-mautrix-instagram.service"
state: absent state: absent
when: "matrix_mautrix_instagram_service_stat.stat.exists" when: "matrix_mautrix_instagram_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-mautrix-instagram.service removal - name: Ensure systemd reloaded after matrix-mautrix-instagram.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_mautrix_instagram_service_stat.stat.exists" when: "matrix_mautrix_instagram_service_stat.stat.exists"

View File

@ -1,6 +1,6 @@
--- ---
- name: Fail if required settings not defined - name: Fail if required settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"

View File

@ -1,11 +1,11 @@
--- ---
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-signal.service', 'matrix-mautrix-signal-daemon.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-signal.service', 'matrix-mautrix-signal-daemon.service'] }}"
when: matrix_mautrix_signal_enabled|bool when: matrix_mautrix_signal_enabled|bool
# If the matrix-synapse role is not used, these variables may not exist. # If the matrix-synapse role is not used, these variables may not exist.
- set_fact: - ansible.builtin.set_fact:
matrix_synapse_container_extra_arguments: > matrix_synapse_container_extra_arguments: >
{{ {{
matrix_synapse_container_extra_arguments|default([]) matrix_synapse_container_extra_arguments|default([])

View File

@ -3,7 +3,7 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases. # We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed - name: Fail if matrix-synapse role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
The matrix-bridge-mautrix-signal role needs to execute before the matrix-synapse role. The matrix-bridge-mautrix-signal role needs to execute before the matrix-synapse role.
when: "matrix_synapse_role_executed|default(False)" when: "matrix_synapse_role_executed|default(False)"
@ -22,7 +22,7 @@
- name: Ensure Mautrix Signal repository is present on self-build - name: Ensure Mautrix Signal repository is present on self-build
git: ansible.builtin.git:
repo: "{{ matrix_mautrix_signal_docker_repo }}" repo: "{{ matrix_mautrix_signal_docker_repo }}"
dest: "{{ matrix_mautrix_signal_docker_src_files_path }}" dest: "{{ matrix_mautrix_signal_docker_src_files_path }}"
force: "yes" force: "yes"
@ -54,7 +54,7 @@
register: matrix_mautrix_signal_daemon_pull_results register: matrix_mautrix_signal_daemon_pull_results
- name: Ensure Mautrix Signal Daemon repository is present on self-build - name: Ensure Mautrix Signal Daemon repository is present on self-build
git: ansible.builtin.git:
repo: "{{ matrix_mautrix_signal_daemon_docker_repo }}" repo: "{{ matrix_mautrix_signal_daemon_docker_repo }}"
dest: "{{ matrix_mautrix_signal_daemon_docker_src_files_path }}" dest: "{{ matrix_mautrix_signal_daemon_docker_src_files_path }}"
force: "yes" force: "yes"
@ -76,7 +76,7 @@
when: "matrix_mautrix_signal_daemon_container_image_self_build|bool" when: "matrix_mautrix_signal_daemon_container_image_self_build|bool"
- name: Ensure Mautrix Signal paths exist - name: Ensure Mautrix Signal paths exist
file: ansible.builtin.file:
path: "{{ item }}" path: "{{ item }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -91,7 +91,7 @@
- "{{ matrix_mautrix_signal_daemon_path }}/data" - "{{ matrix_mautrix_signal_daemon_path }}/data"
- name: Ensure mautrix-signal config.yaml installed - name: Ensure mautrix-signal config.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_mautrix_signal_configuration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_mautrix_signal_configuration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_mautrix_signal_config_path }}/config.yaml" dest: "{{ matrix_mautrix_signal_config_path }}/config.yaml"
mode: 0644 mode: 0644
@ -99,7 +99,7 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure mautrix-signal registration.yaml installed - name: Ensure mautrix-signal registration.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_mautrix_signal_registration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_mautrix_signal_registration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_mautrix_signal_config_path }}/registration.yaml" dest: "{{ matrix_mautrix_signal_config_path }}/registration.yaml"
mode: 0644 mode: 0644
@ -107,20 +107,20 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-mautrix-signal-daemon.service installed - name: Ensure matrix-mautrix-signal-daemon.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-mautrix-signal-daemon.service.j2" src: "{{ role_path }}/templates/systemd/matrix-mautrix-signal-daemon.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-mautrix-signal-daemon.service" dest: "{{ matrix_systemd_path }}/matrix-mautrix-signal-daemon.service"
mode: 0644 mode: 0644
register: matrix_mautrix_signal_daemon_systemd_service_result register: matrix_mautrix_signal_daemon_systemd_service_result
- name: Ensure matrix-mautrix-signal.service installed - name: Ensure matrix-mautrix-signal.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-mautrix-signal.service.j2" src: "{{ role_path }}/templates/systemd/matrix-mautrix-signal.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-mautrix-signal.service" dest: "{{ matrix_systemd_path }}/matrix-mautrix-signal.service"
mode: 0644 mode: 0644
register: matrix_mautrix_signal_systemd_service_result register: matrix_mautrix_signal_systemd_service_result
- name: Ensure systemd reloaded after matrix-mautrix-signal.service installation - name: Ensure systemd reloaded after matrix-mautrix-signal.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_mautrix_signal_systemd_service_result.changed or matrix_mautrix_signal_daemon_systemd_service_result.changed" when: "matrix_mautrix_signal_systemd_service_result.changed or matrix_mautrix_signal_daemon_systemd_service_result.changed"

View File

@ -7,7 +7,7 @@
register: matrix_mautrix_signal_daemon_service_stat register: matrix_mautrix_signal_daemon_service_stat
- name: Ensure matrix-mautrix-signal-daemon is stopped - name: Ensure matrix-mautrix-signal-daemon is stopped
service: ansible.builtin.service:
name: matrix-mautrix-signal-daemon name: matrix-mautrix-signal-daemon
state: stopped state: stopped
enabled: false enabled: false
@ -15,7 +15,7 @@
when: "matrix_mautrix_signal_daemon_service_stat.stat.exists" when: "matrix_mautrix_signal_daemon_service_stat.stat.exists"
- name: Ensure matrix-mautrix-signal-daemon.service doesn't exist - name: Ensure matrix-mautrix-signal-daemon.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-mautrix-signal-daemon.service" path: "{{ matrix_systemd_path }}/matrix-mautrix-signal-daemon.service"
state: absent state: absent
when: "matrix_mautrix_signal_daemon_service_stat.stat.exists" when: "matrix_mautrix_signal_daemon_service_stat.stat.exists"
@ -27,7 +27,7 @@
register: matrix_mautrix_signal_service_stat register: matrix_mautrix_signal_service_stat
- name: Ensure matrix-mautrix-signal is stopped - name: Ensure matrix-mautrix-signal is stopped
service: ansible.builtin.service:
name: matrix-mautrix-signal name: matrix-mautrix-signal
state: stopped state: stopped
enabled: false enabled: false
@ -35,13 +35,13 @@
when: "matrix_mautrix_signal_service_stat.stat.exists" when: "matrix_mautrix_signal_service_stat.stat.exists"
- name: Ensure matrix-mautrix-signal.service doesn't exist - name: Ensure matrix-mautrix-signal.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-mautrix-signal.service" path: "{{ matrix_systemd_path }}/matrix-mautrix-signal.service"
state: absent state: absent
when: "matrix_mautrix_signal_service_stat.stat.exists" when: "matrix_mautrix_signal_service_stat.stat.exists"
# All services # All services
- name: Ensure systemd reloaded after matrix-mautrix-signal_X.service removal - name: Ensure systemd reloaded after matrix-mautrix-signal_X.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_mautrix_signal_service_stat.stat.exists or matrix_mautrix_signal_daemon_service_stat.stat.exists" when: "matrix_mautrix_signal_service_stat.stat.exists or matrix_mautrix_signal_daemon_service_stat.stat.exists"

View File

@ -1,7 +1,7 @@
--- ---
- name: Fail if required settings not defined - name: Fail if required settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"
@ -12,7 +12,7 @@
- "matrix_mautrix_signal_appservice_token" - "matrix_mautrix_signal_appservice_token"
- name: (Deprecation) Catch and report renamed Signal variables - name: (Deprecation) Catch and report renamed Signal variables
fail: ansible.builtin.fail:
msg: >- msg: >-
Your configuration contains a variable, which now has a different name. Your configuration contains a variable, which now has a different name.
Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).

View File

@ -2,16 +2,16 @@
# See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070
# and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407
- name: Fail if trying to self-build on Ansible < 2.8 - name: Fail if trying to self-build on Ansible < 2.8
fail: ansible.builtin.fail:
msg: "To self-build the Element image, you should use Ansible 2.8 or higher. See docs/ansible.md" msg: "To self-build the Element image, you should use Ansible 2.8 or higher. See docs/ansible.md"
when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_telegram_container_image_self_build and matrix_mautrix_telegram_enabled" when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_telegram_container_image_self_build and matrix_mautrix_telegram_enabled"
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-telegram.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-telegram.service'] }}"
when: matrix_mautrix_telegram_enabled|bool when: matrix_mautrix_telegram_enabled|bool
# If the matrix-synapse role is not used, these variables may not exist. # If the matrix-synapse role is not used, these variables may not exist.
- set_fact: - ansible.builtin.set_fact:
matrix_synapse_container_extra_arguments: > matrix_synapse_container_extra_arguments: >
{{ {{
matrix_synapse_container_extra_arguments|default([]) matrix_synapse_container_extra_arguments|default([])
@ -29,7 +29,7 @@
- block: - block:
- name: Fail if matrix-nginx-proxy role already executed - name: Fail if matrix-nginx-proxy role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
Trying to append Mautrix Telegram's reverse-proxying configuration to matrix-nginx-proxy, Trying to append Mautrix Telegram's reverse-proxying configuration to matrix-nginx-proxy,
but it's pointless since the matrix-nginx-proxy role had already executed. but it's pointless since the matrix-nginx-proxy role had already executed.
@ -38,7 +38,7 @@
when: matrix_nginx_proxy_role_executed|default(False)|bool when: matrix_nginx_proxy_role_executed|default(False)|bool
- name: Generate Mautrix Telegram proxying configuration for matrix-nginx-proxy - name: Generate Mautrix Telegram proxying configuration for matrix-nginx-proxy
set_fact: ansible.builtin.set_fact:
matrix_mautrix_telegram_matrix_nginx_proxy_configuration: | matrix_mautrix_telegram_matrix_nginx_proxy_configuration: |
location {{ matrix_mautrix_telegram_public_endpoint }} { location {{ matrix_mautrix_telegram_public_endpoint }} {
{% if matrix_nginx_proxy_enabled|default(False) %} {% if matrix_nginx_proxy_enabled|default(False) %}
@ -53,7 +53,7 @@
} }
- name: Register Mautrix Telegram proxying configuration with matrix-nginx-proxy - name: Register Mautrix Telegram proxying configuration with matrix-nginx-proxy
set_fact: ansible.builtin.set_fact:
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
{{ {{
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([])
@ -61,7 +61,7 @@
[matrix_mautrix_telegram_matrix_nginx_proxy_configuration] [matrix_mautrix_telegram_matrix_nginx_proxy_configuration]
}} }}
- name: Warn about reverse-proxying if matrix-nginx-proxy not used - name: Warn about reverse-proxying if matrix-nginx-proxy not used
debug: ansible.builtin.debug:
msg: >- msg: >-
NOTE: You've enabled the Mautrix Telegram bridge but are not using the matrix-nginx-proxy NOTE: You've enabled the Mautrix Telegram bridge but are not using the matrix-nginx-proxy
reverse proxy. reverse proxy.

View File

@ -3,12 +3,12 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases. # We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed - name: Fail if matrix-synapse role already executed
fail: ansible.builtin.fail:
msg: >- msg: >-
The matrix-bridge-mautrix-telegram role needs to execute before the matrix-synapse role. The matrix-bridge-mautrix-telegram role needs to execute before the matrix-synapse role.
when: "matrix_synapse_role_executed|default(False)" when: "matrix_synapse_role_executed|default(False)"
- set_fact: - ansible.builtin.set_fact:
matrix_mautrix_telegram_requires_restart: false matrix_mautrix_telegram_requires_restart: false
- block: - block:
@ -18,7 +18,7 @@
register: matrix_mautrix_telegram_sqlite_database_path_local_stat_result register: matrix_mautrix_telegram_sqlite_database_path_local_stat_result
- block: - block:
- set_fact: - ansible.builtin.set_fact:
matrix_postgres_db_migration_request: matrix_postgres_db_migration_request:
src: "{{ matrix_mautrix_telegram_sqlite_database_path_local }}" src: "{{ matrix_mautrix_telegram_sqlite_database_path_local }}"
dst: "{{ matrix_mautrix_telegram_database_connection_string }}" dst: "{{ matrix_mautrix_telegram_database_connection_string }}"
@ -29,13 +29,13 @@
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
- set_fact: - ansible.builtin.set_fact:
matrix_mautrix_telegram_requires_restart: true matrix_mautrix_telegram_requires_restart: true
when: "matrix_mautrix_telegram_sqlite_database_path_local_stat_result.stat.exists|bool" when: "matrix_mautrix_telegram_sqlite_database_path_local_stat_result.stat.exists|bool"
when: "matrix_mautrix_telegram_database_engine == 'postgres'" when: "matrix_mautrix_telegram_database_engine == 'postgres'"
- name: Ensure Mautrix Telegram paths exist - name: Ensure Mautrix Telegram paths exist
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
mode: 0750 mode: 0750
@ -61,7 +61,7 @@
until: result is not failed until: result is not failed
- name: Ensure lottieconverter is present when self-building - name: Ensure lottieconverter is present when self-building
git: ansible.builtin.git:
repo: "{{ matrix_telegram_lottieconverter_docker_repo }}" repo: "{{ matrix_telegram_lottieconverter_docker_repo }}"
dest: "{{ matrix_telegram_lottieconverter_docker_src_files_path }}" dest: "{{ matrix_telegram_lottieconverter_docker_src_files_path }}"
force: "yes" force: "yes"
@ -83,7 +83,7 @@
when: "matrix_telegram_lottieconverter_container_image_self_build|bool and matrix_telegram_lottieconverter_git_pull_results.changed and matrix_mautrix_telegram_container_image_self_build|bool" when: "matrix_telegram_lottieconverter_container_image_self_build|bool and matrix_telegram_lottieconverter_git_pull_results.changed and matrix_mautrix_telegram_container_image_self_build|bool"
- name: Ensure matrix-mautrix-telegram repository is present when self-building - name: Ensure matrix-mautrix-telegram repository is present when self-building
git: ansible.builtin.git:
repo: "{{ matrix_mautrix_telegram_docker_repo }}" repo: "{{ matrix_mautrix_telegram_docker_repo }}"
dest: "{{ matrix_mautrix_telegram_docker_src_files_path }}" dest: "{{ matrix_mautrix_telegram_docker_src_files_path }}"
force: "yes" force: "yes"
@ -112,7 +112,7 @@
register: matrix_mautrix_telegram_stat_database register: matrix_mautrix_telegram_stat_database
- name: (Data relocation) Ensure matrix-mautrix-telegram.service is stopped - name: (Data relocation) Ensure matrix-mautrix-telegram.service is stopped
service: ansible.builtin.service:
name: matrix-mautrix-telegram name: matrix-mautrix-telegram
state: stopped state: stopped
enabled: false enabled: false
@ -121,11 +121,11 @@
when: "matrix_mautrix_telegram_stat_database.stat.exists" when: "matrix_mautrix_telegram_stat_database.stat.exists"
- name: (Data relocation) Move mautrix-telegram database file to ./data directory - name: (Data relocation) Move mautrix-telegram database file to ./data directory
command: "mv {{ matrix_mautrix_telegram_base_path }}/mautrix-telegram.db {{ matrix_mautrix_telegram_data_path }}/mautrix-telegram.db" ansible.builtin.command: "mv {{ matrix_mautrix_telegram_base_path }}/mautrix-telegram.db {{ matrix_mautrix_telegram_data_path }}/mautrix-telegram.db"
when: "matrix_mautrix_telegram_stat_database.stat.exists" when: "matrix_mautrix_telegram_stat_database.stat.exists"
- name: Ensure mautrix-telegram config.yaml installed - name: Ensure mautrix-telegram config.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_mautrix_telegram_configuration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_mautrix_telegram_configuration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_mautrix_telegram_config_path }}/config.yaml" dest: "{{ matrix_mautrix_telegram_config_path }}/config.yaml"
mode: 0644 mode: 0644
@ -133,7 +133,7 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure mautrix-telegram registration.yaml installed - name: Ensure mautrix-telegram registration.yaml installed
copy: ansible.builtin.copy:
content: "{{ matrix_mautrix_telegram_registration|to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_mautrix_telegram_registration|to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_mautrix_telegram_config_path }}/registration.yaml" dest: "{{ matrix_mautrix_telegram_config_path }}/registration.yaml"
mode: 0644 mode: 0644
@ -141,19 +141,19 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-mautrix-telegram.service installed - name: Ensure matrix-mautrix-telegram.service installed
template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-mautrix-telegram.service.j2" src: "{{ role_path }}/templates/systemd/matrix-mautrix-telegram.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-mautrix-telegram.service" dest: "{{ matrix_systemd_path }}/matrix-mautrix-telegram.service"
mode: 0644 mode: 0644
register: matrix_mautrix_telegram_systemd_service_result register: matrix_mautrix_telegram_systemd_service_result
- name: Ensure systemd reloaded after matrix-mautrix-telegram.service installation - name: Ensure systemd reloaded after matrix-mautrix-telegram.service installation
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_mautrix_telegram_systemd_service_result.changed" when: "matrix_mautrix_telegram_systemd_service_result.changed"
- name: Ensure matrix-mautrix-telegram.service restarted, if necessary - name: Ensure matrix-mautrix-telegram.service restarted, if necessary
service: ansible.builtin.service:
name: "matrix-mautrix-telegram.service" name: "matrix-mautrix-telegram.service"
state: restarted state: restarted
when: "matrix_mautrix_telegram_requires_restart|bool" when: "matrix_mautrix_telegram_requires_restart|bool"

View File

@ -6,7 +6,7 @@
register: matrix_mautrix_telegram_service_stat register: matrix_mautrix_telegram_service_stat
- name: Ensure matrix-mautrix-telegram is stopped - name: Ensure matrix-mautrix-telegram is stopped
service: ansible.builtin.service:
name: matrix-mautrix-telegram name: matrix-mautrix-telegram
state: stopped state: stopped
enabled: false enabled: false
@ -14,12 +14,12 @@
when: "matrix_mautrix_telegram_service_stat.stat.exists" when: "matrix_mautrix_telegram_service_stat.stat.exists"
- name: Ensure matrix-mautrix-telegram.service doesn't exist - name: Ensure matrix-mautrix-telegram.service doesn't exist
file: ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-mautrix-telegram.service" path: "{{ matrix_systemd_path }}/matrix-mautrix-telegram.service"
state: absent state: absent
when: "matrix_mautrix_telegram_service_stat.stat.exists" when: "matrix_mautrix_telegram_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-mautrix-telegram.service removal - name: Ensure systemd reloaded after matrix-mautrix-telegram.service removal
service: ansible.builtin.service:
daemon_reload: true daemon_reload: true
when: "matrix_mautrix_telegram_service_stat.stat.exists" when: "matrix_mautrix_telegram_service_stat.stat.exists"

View File

@ -1,7 +1,7 @@
--- ---
- name: Fail if required settings not defined - name: Fail if required settings not defined
fail: ansible.builtin.fail:
msg: >- msg: >-
You need to define a required configuration setting (`{{ item }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"
@ -13,7 +13,7 @@
- "matrix_mautrix_telegram_homeserver_token" - "matrix_mautrix_telegram_homeserver_token"
- name: (Deprecation) Catch and report renamed Telegram variables - name: (Deprecation) Catch and report renamed Telegram variables
fail: ansible.builtin.fail:
msg: >- msg: >-
Your configuration contains a variable, which now has a different name. Your configuration contains a variable, which now has a different name.
Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).

View File

@ -1,11 +1,11 @@
--- ---
- set_fact: - ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-twitter.service'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-twitter.service'] }}"
when: matrix_mautrix_twitter_enabled|bool when: matrix_mautrix_twitter_enabled|bool
# If the matrix-synapse role is not used, these variables may not exist. # If the matrix-synapse role is not used, these variables may not exist.
- set_fact: - ansible.builtin.set_fact:
matrix_synapse_container_extra_arguments: > matrix_synapse_container_extra_arguments: >
{{ {{
matrix_synapse_container_extra_arguments|default([]) matrix_synapse_container_extra_arguments|default([])
@ -24,6 +24,6 @@
# ansible lower than 2.8, does not support docker_image build parameters # ansible lower than 2.8, does not support docker_image build parameters
# for self buildig it is explicitly needed, so we rather fail here # for self buildig it is explicitly needed, so we rather fail here
- name: Fail if running on Ansible lower than 2.8 and trying self building - name: Fail if running on Ansible lower than 2.8 and trying self building
fail: ansible.builtin.fail:
msg: "To self build Mautrix Twitter image, you should usa ansible 2.8 or higher. E.g. pip contains such packages." msg: "To self build Mautrix Twitter image, you should usa ansible 2.8 or higher. E.g. pip contains such packages."
when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_twitter_container_image_self_build" when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_twitter_container_image_self_build"

Some files were not shown because too many files have changed in this diff Show More