Merge pull request #1948 from spantaleev/ansible-lint-fixes

Ansible lint fixes
development
Slavi Pantaleev 2 years ago committed by GitHub
commit cbada7341d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,13 @@
---
use_default_rules: true
skip_list:
- unnamed-task
- no-handler
- no-jinja-nesting
- schema
- command-instead-of-shell
- role-name
offline: false

@ -0,0 +1,7 @@
.PHONY: lint
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
lint: ## Runs ansible-lint against all roles in the playbook
ansible-lint

@ -1,6 +1,6 @@
---
- import_tasks: "{{ role_path }}/tasks/setup.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup.yml"
when: run_stop | bool
tags:
- setup-all

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

@ -8,6 +8,7 @@ matrix_backup_borg_config_path: "{{ matrix_backup_borg_base_path }}/config"
matrix_backup_borg_container_image_self_build: false
matrix_backup_borg_docker_repo: "https://gitlab.com/etke.cc/borgmatic"
matrix_backup_borg_docker_repo_version: main
matrix_backup_borg_docker_src_files_path: "{{ matrix_backup_borg_base_path }}/docker-src"
# version determined automatically, based on postgres server version (if enabled), otherwise latest is used

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

@ -1,22 +1,22 @@
---
- import_tasks: "{{ role_path }}/tasks/init.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
tags:
- always
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup | bool and matrix_backup_borg_enabled | bool"
tags:
- setup-all
- setup-backup-borg
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup | bool and matrix_backup_borg_enabled | bool"
tags:
- setup-all
- setup-backup-borg
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup | bool and not matrix_backup_borg_enabled | bool"
tags:
- setup-all

@ -1,19 +1,22 @@
---
- block:
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/detect_existing_postgres_version.yml"
- ansible.builtin.import_role:
name: matrix-postgres
tasks_from: detect_existing_postgres_version
- 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"
when: "matrix_postgres_detected_version not in matrix_backup_borg_supported_postgres_versions"
- name: Set the correct borg backup version to use
set_fact:
ansible.builtin.set_fact:
matrix_backup_borg_version: "{{ matrix_postgres_detected_version }}"
when: matrix_backup_borg_postgresql_enabled | bool and matrix_backup_borg_version == ''
- name: Ensure borg paths exist
file:
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
mode: 0750
@ -25,7 +28,7 @@
when: "item.when | bool"
- name: Ensure borgmatic config is created
copy:
ansible.builtin.copy:
content: "{{ matrix_backup_borg_configuration | to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_backup_borg_config_path }}/config.yaml"
owner: "{{ matrix_user_username }}"
@ -33,7 +36,7 @@
mode: 0640
- name: Ensure borg passwd is created
template:
ansible.builtin.template:
src: "{{ role_path }}/templates/passwd.j2"
dest: "{{ matrix_backup_borg_config_path }}/passwd"
owner: "{{ matrix_user_username }}"
@ -41,7 +44,7 @@
mode: 0640
- name: Ensure borg ssh key is created
template:
ansible.builtin.template:
src: "{{ role_path }}/templates/sshkey.j2"
dest: "{{ matrix_backup_borg_config_path }}/sshkey"
owner: "{{ matrix_user_username }}"
@ -61,8 +64,9 @@
until: result is not failed
- name: Ensure borg repository is present on self-build
git:
ansible.builtin.git:
repo: "{{ matrix_backup_borg_docker_repo }}"
version: "{{ matrix_backup_borg_docker_repo_version }}"
dest: "{{ matrix_backup_borg_docker_src_files_path }}"
force: "yes"
become: true
@ -83,30 +87,30 @@
when: "matrix_backup_borg_container_image_self_build | bool"
- name: Ensure matrix-backup-borg.service installed
template:
ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-backup-borg.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-backup-borg.service"
mode: 0644
register: matrix_backup_borg_systemd_service_result
- name: Ensure matrix-backup-borg.timer installed
template:
ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-backup-borg.timer.j2"
dest: "{{ matrix_systemd_path }}/matrix-backup-borg.timer"
mode: 0644
register: matrix_backup_borg_systemd_timer_result
- name: Ensure systemd reloaded after matrix-backup-borg.service installation
service:
ansible.builtin.service:
daemon_reload: true
when: "matrix_backup_borg_systemd_service_result.changed | bool"
- name: Ensure matrix-backup-borg.service enabled
service:
ansible.builtin.service:
enabled: true
name: matrix-backup-borg.service
- name: Ensure matrix-backup-borg.timer enabled
service:
ansible.builtin.service:
enabled: true
name: matrix-backup-borg.timer

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

@ -1,6 +1,6 @@
---
- name: Fail if required settings not defined
fail:
ansible.builtin.fail:
msg: >-
You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''"
@ -9,7 +9,7 @@
- "matrix_backup_borg_location_repositories"
- name: Fail if encryption passphrase is undefined unless repository is unencrypted
fail:
ansible.builtin.fail:
msg: >-
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'"

@ -157,7 +157,7 @@ matrix_integration_manager_ui_url: ~
# The domain name where a Jitsi server is self-hosted.
# If set, `/.well-known/matrix/client` will suggest Element clients to use that Jitsi server.
# See: https://github.com/vector-im/element-web/blob/develop/docs/jitsi.md#configuring-element-to-use-your-self-hosted-jitsi-server
matrix_client_element_jitsi_preferredDomain: ''
matrix_client_element_jitsi_preferredDomain: '' # noqa var-naming
# Controls whether Element should use End-to-End Encryption by default.
# Setting this to false will update `/.well-known/matrix/client` and tell Element clients to avoid E2EE.

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

@ -1,33 +1,33 @@
---
- import_tasks: "{{ role_path }}/tasks/sanity_check.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/sanity_check.yml"
tags:
- always
- import_tasks: "{{ role_path }}/tasks/clean_up_old_files.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/clean_up_old_files.yml"
when: run_setup | bool
tags:
- setup-all
- import_tasks: "{{ role_path }}/tasks/server_base/setup.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/server_base/setup.yml"
when: run_setup | bool
tags:
- setup-all
# This needs to always run, because it populates `matrix_user_uid` and `matrix_user_gid`,
# which are required by many other roles.
- import_tasks: "{{ role_path }}/tasks/setup_matrix_user.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_matrix_user.yml"
when: run_setup | bool
tags:
- always
- setup-system-user
- import_tasks: "{{ role_path }}/tasks/setup_matrix_base.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_matrix_base.yml"
when: run_setup | bool
tags:
- setup-all
- import_tasks: "{{ role_path }}/tasks/setup_well_known.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_well_known.yml"
when: run_setup | bool
tags:
- setup-all

@ -1,27 +1,27 @@
---
- name: Fail if invalid homeserver implementation
fail:
ansible.builtin.fail:
msg: "You need to set a valid homeserver implementation in `matrix_homeserver_implementation`"
when: "matrix_homeserver_implementation not in ['synapse', 'dendrite']"
# We generally support Ansible 2.7.1 and above.
- 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"
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)"
# Though we do not support Ansible 2.9.6 which is buggy
- 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"
when:
- ansible_distribution == 'Ubuntu'
- "ansible_version.major == 2 and ansible_version.minor == 9 and ansible_version.revision == 6"
- name: (Deprecation) Catch and report renamed settings
fail:
ansible.builtin.fail:
msg: >-
Your configuration contains a variable, which now has a different name.
Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
@ -35,7 +35,7 @@
# 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
fail:
ansible.builtin.fail:
msg: |
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 == ''"
- 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"
with_items:
- {'var': matrix_domain, 'value': "{{ matrix_domain | default('') }}"}
@ -58,7 +58,7 @@
when: "item.value is none or item.value == ''"
- 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!"
with_items:
- "{{ matrix_domain }}"
@ -67,21 +67,21 @@
when: "item != item | lower"
- 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."
when:
- ansible_distribution == 'Archlinux'
- ansible_python.version.major != 3
- 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 }}."
when: (ansible_architecture == "x86_64" and matrix_architecture != "amd64") or
(ansible_architecture == "aarch64" and matrix_architecture != "arm64") or
(ansible_architecture.startswith("armv") and matrix_architecture != "arm32")
- name: Fail if encountering usage of removed role (mx-puppet-skype)
fail:
ansible.builtin.fail:
msg: >-
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.

@ -1,18 +1,18 @@
---
- include_tasks: "{{ role_path }}/tasks/server_base/setup_redhat.yml"
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/server_base/setup_redhat.yml"
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version | int < 8
- include_tasks: "{{ role_path }}/tasks/server_base/setup_redhat8.yml"
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/server_base/setup_redhat8.yml"
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version | int > 7 and ansible_distribution_major_version | int < 30
- include_tasks: "{{ role_path }}/tasks/server_base/setup_fedora.yml"
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/server_base/setup_fedora.yml"
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version | int > 30
- block:
# ansible_lsb is only available if lsb-release is installed.
- name: Ensure lsb-release installed
apt:
ansible.builtin.apt:
name:
- lsb-release
state: present
@ -20,27 +20,27 @@
register: lsb_release_installation_result
- name: Reread ansible_lsb facts if lsb-release got installed
setup: filter=ansible_lsb*
ansible.builtin.setup: filter=ansible_lsb*
when: lsb_release_installation_result.changed
- include_tasks: "{{ role_path }}/tasks/server_base/setup_debian.yml"
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/server_base/setup_debian.yml"
when: (ansible_os_family == 'Debian') and (ansible_lsb.id != 'Raspbian')
- include_tasks: "{{ role_path }}/tasks/server_base/setup_raspbian.yml"
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/server_base/setup_raspbian.yml"
when: (ansible_os_family == 'Debian') and (ansible_lsb.id == 'Raspbian')
when: ansible_os_family == 'Debian'
- include_tasks: "{{ role_path }}/tasks/server_base/setup_archlinux.yml"
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/server_base/setup_archlinux.yml"
when: ansible_distribution == 'Archlinux'
- name: Ensure Docker is started and autoruns
service:
ansible.builtin.service:
name: docker
state: started
enabled: true
- name: "Ensure {{ matrix_ntpd_service }} is started and autoruns"
service:
ansible.builtin.service:
name: "{{ matrix_ntpd_service }}"
state: started
enabled: true

@ -5,12 +5,12 @@
name:
- python-docker
- python-dnspython
state: latest
state: present
update_cache: true
- name: Ensure Docker is installed
pacman:
name:
- docker
state: latest
state: present
when: matrix_docker_installation_enabled | bool

@ -1,7 +1,7 @@
---
- name: Ensure APT usage dependencies are installed
apt:
ansible.builtin.apt:
name:
- apt-transport-https
- ca-certificates
@ -10,7 +10,7 @@
update_cache: true
- name: Ensure Docker's APT key is trusted
apt_key:
ansible.builtin.apt_key:
url: "https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg"
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
state: present
@ -19,23 +19,23 @@
when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure Docker repository is enabled
apt_repository:
ansible.builtin.apt_repository:
repo: "deb [arch={{ matrix_debian_arch }}] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable"
state: present
update_cache: true
when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure APT packages are installed
apt:
ansible.builtin.apt:
name:
- "{{ matrix_ntpd_package }}"
state: latest
state: present
update_cache: true
- name: Ensure Docker is installed
apt:
ansible.builtin.apt:
name:
- "{{ matrix_docker_package_name }}"
- "python{{ '3' if ansible_python.version.major == 3 else '' }}-docker"
state: latest
state: present
when: matrix_docker_installation_enabled | bool

@ -1,7 +1,7 @@
---
- name: Ensure Docker repository is enabled
template:
ansible.builtin.template:
src: "{{ role_path }}/files/yum.repos.d/{{ item }}"
dest: "/etc/yum.repos.d/docker-ce.repo"
owner: "root"
@ -12,28 +12,28 @@
when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure Docker's RPM key is trusted
rpm_key:
ansible.builtin.rpm_key:
state: present
key: https://download.docker.com/linux/fedora/gpg
when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure yum packages are installed
yum:
ansible.builtin.yum:
name:
- "{{ matrix_ntpd_package }}"
state: latest
state: present
update_cache: true
- name: Ensure Docker is installed
yum:
ansible.builtin.yum:
name:
- "{{ matrix_docker_package_name }}"
- python3-pip
state: latest
state: present
when: matrix_docker_installation_enabled | bool
- name: Ensure Docker-Py is installed
pip:
ansible.builtin.pip:
name: docker-py
state: latest
state: present
when: matrix_docker_installation_enabled | bool

@ -1,7 +1,7 @@
---
- name: Ensure APT usage dependencies are installed
apt:
ansible.builtin.apt:
name:
- apt-transport-https
- ca-certificates
@ -10,7 +10,7 @@
update_cache: true
- name: Ensure Docker's APT key is trusted
apt_key:
ansible.builtin.apt_key:
url: https://download.docker.com/linux/raspbian/gpg
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
state: present
@ -19,23 +19,23 @@
when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure Docker repository is enabled
apt_repository:
ansible.builtin.apt_repository:
repo: "deb [arch={{ matrix_debian_arch }}] https://download.docker.com/linux/raspbian {{ ansible_distribution_release }} stable"
state: present
update_cache: true
when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure APT packages are installed
apt:
ansible.builtin.apt:
name:
- "{{ matrix_ntpd_package }}"
state: latest
state: present
update_cache: true
- name: Ensure Docker is installed
apt:
ansible.builtin.apt:
name:
- "{{ matrix_docker_package_name }}"
- "python{{'3' if ansible_python.version.major == 3 else ''}}-docker"
state: latest
state: present
when: matrix_docker_installation_enabled | bool

@ -1,7 +1,7 @@
---
- name: Ensure Docker repository is enabled
template:
ansible.builtin.template:
src: "{{ role_path }}/files/yum.repos.d/docker-ce-centos.repo"
dest: "/etc/yum.repos.d/docker-ce.repo"
owner: "root"
@ -10,22 +10,22 @@
when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure Docker's RPM key is trusted
rpm_key:
ansible.builtin.rpm_key:
state: present
key: https://download.docker.com/linux/centos/gpg
when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure yum packages are installed
yum:
ansible.builtin.yum:
name:
- "{{ matrix_ntpd_package }}"
state: latest
state: present
update_cache: true
- name: Ensure Docker is installed
yum:
ansible.builtin.yum:
name:
- "{{ matrix_docker_package_name }}"
- docker-python
state: latest
state: present
when: matrix_docker_installation_enabled | bool

@ -1,7 +1,7 @@
---
- name: Ensure Docker repository is enabled
template:
ansible.builtin.template:
src: "{{ role_path }}/files/yum.repos.d/docker-ce-centos.repo"
dest: "/etc/yum.repos.d/docker-ce.repo"
owner: "root"
@ -10,35 +10,35 @@
when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure Docker's RPM key is trusted
rpm_key:
ansible.builtin.rpm_key:
state: present
key: https://download.docker.com/linux/centos/gpg
when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce'
- name: Ensure EPEL is installed
yum:
ansible.builtin.yum:
name:
- epel-release
state: latest
state: present
update_cache: true
- name: Ensure yum packages are installed
yum:
ansible.builtin.yum:
name:
- "{{ matrix_ntpd_package }}"
state: latest
state: present
update_cache: true
- name: Ensure Docker is installed
yum:
ansible.builtin.yum:
name:
- "{{ matrix_docker_package_name }}"
- python3-pip
state: latest
state: present
when: matrix_docker_installation_enabled | bool
- name: Ensure Docker-Py is installed
pip:
ansible.builtin.pip:
name: docker-py
state: latest
state: present
when: matrix_docker_installation_enabled | bool

@ -1,7 +1,7 @@
---
- name: Ensure Matrix base path exists
file:
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: "{{ matrix_base_data_path_mode }}"
@ -11,7 +11,7 @@
- "{{ matrix_base_data_path }}"
- 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 }}"
dest: "{{ matrix_base_data_path }}/vars.yml"
owner: "{{ matrix_user_username }}"
@ -25,7 +25,7 @@
driver: bridge
- name: Ensure matrix-remove-all script created
template:
ansible.builtin.template:
src: "{{ role_path }}/templates/usr-local-bin/matrix-remove-all.j2"
dest: "{{ matrix_local_bin_path }}/matrix-remove-all"
mode: 0750

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

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

@ -1,23 +1,23 @@
---
# This is for both RedHat 7 and 8
- name: Ensure fuse installed (RedHat)
yum:
ansible.builtin.yum:
name:
- fuse
state: latest
state: present
when: ansible_os_family == 'RedHat'
# This is for both Debian and Raspbian
- name: Ensure fuse installed (Debian/Raspbian)
apt:
ansible.builtin.apt:
name:
- fuse
state: latest
state: present
when: ansible_os_family == 'Debian'
- name: Ensure fuse installed (Archlinux)
pacman:
name:
- fuse3
state: latest
state: present
when: ansible_distribution == 'Archlinux'

@ -1,23 +1,23 @@
---
# This is for both RedHat 7 and 8
- name: Ensure openssl installed (RedHat)
yum:
ansible.builtin.yum:
name:
- openssl
state: latest
state: present
when: ansible_os_family == 'RedHat'
# This is for both Debian and Raspbian
- name: Ensure openssl installed (Debian/Raspbian)
apt:
ansible.builtin.apt:
name:
- openssl
state: latest
state: present
when: ansible_os_family == 'Debian'
- name: Ensure openssl installed (Archlinux)
pacman:
name:
- openssl
state: latest
state: present
when: ansible_distribution == 'Archlinux'

@ -6,6 +6,7 @@ matrix_bot_buscarron_enabled: true
matrix_bot_buscarron_container_image_self_build: false
matrix_bot_buscarron_docker_repo: "https://gitlab.com/etke.cc/buscarron.git"
matrix_bot_buscarron_docker_repo_version: "{{ matrix_bot_buscarron_version }}"
matrix_bot_buscarron_docker_src_files_path: "{{ matrix_base_data_path }}/buscarron/docker-src"
matrix_bot_buscarron_version: v1.2.0

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

@ -1,22 +1,22 @@
---
- import_tasks: "{{ role_path }}/tasks/init.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
tags:
- always
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup | bool and matrix_bot_buscarron_enabled | bool"
tags:
- setup-all
- setup-bot-buscarron
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup | bool and matrix_bot_buscarron_enabled | bool"
tags:
- setup-all
- setup-bot-buscarron
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup | bool and not matrix_bot_buscarron_enabled | bool"
tags:
- setup-all

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

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

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

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

@ -1,22 +1,22 @@
---
- import_tasks: "{{ role_path }}/tasks/init.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
tags:
- always
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup | bool and matrix_bot_go_neb_enabled | bool"
tags:
- setup-all
- setup-bot-go-neb
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup | bool and matrix_bot_go_neb_enabled | bool"
tags:
- setup-all
- setup-bot-go-neb
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup | bool and not matrix_bot_go_neb_enabled | bool"
tags:
- setup-all

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

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

@ -1,13 +1,13 @@
---
- name: Fail if there's not at least 1 client
fail:
ansible.builtin.fail:
msg: >-
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
- name: Fail if there's not at least 1 service
fail:
ansible.builtin.fail:
msg: >-
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

@ -6,6 +6,7 @@ matrix_bot_honoroit_enabled: true
matrix_bot_honoroit_container_image_self_build: false
matrix_bot_honoroit_docker_repo: "https://gitlab.com/etke.cc/honoroit.git"
matrix_bot_honoroit_docker_repo_version: "{{ matrix_bot_honoroit_version }}"
matrix_bot_honoroit_docker_src_files_path: "{{ matrix_base_data_path }}/honoroit/docker-src"
matrix_bot_honoroit_version: v0.9.9

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

@ -1,22 +1,22 @@
---
- import_tasks: "{{ role_path }}/tasks/init.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
tags:
- always
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup | bool and matrix_bot_honoroit_enabled | bool"
tags:
- setup-all
- setup-bot-honoroit
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup | bool and matrix_bot_honoroit_enabled | bool"
tags:
- setup-all
- setup-bot-honoroit
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup | bool and not matrix_bot_honoroit_enabled | bool"
tags:
- setup-all

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

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

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

@ -5,6 +5,7 @@
matrix_bot_matrix_registration_bot_enabled: true
matrix_bot_matrix_registration_bot_container_image_self_build: false
matrix_bot_matrix_registration_bot_docker_repo: "https://github.com/moan0s/matrix-registration-bot.git"
matrix_bot_matrix_registration_bot_docker_repo_version: "{{ matrix_bot_matrix_registration_bot_version if matrix_bot_matrix_registration_bot_version != 'latest' else 'main' }}"
matrix_bot_matrix_registration_bot_docker_src_files_path: "{{ matrix_bot_matrix_registration_bot_base_path }}/docker-src"
matrix_bot_matrix_registration_bot_version: latest

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

@ -1,22 +1,22 @@
---
- import_tasks: "{{ role_path }}/tasks/init.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
tags:
- always
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup | bool and matrix_bot_matrix_registration_bot_enabled | bool"
tags:
- setup-all
- setup-bot-matrix-registration-bot
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup | bool and matrix_bot_matrix_registration_bot_enabled | bool"
tags:
- setup-all
- setup-bot-matrix-registration-bot
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup | bool and not matrix_bot_matrix_registration_bot_enabled | bool"
tags:
- setup-all

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

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

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

@ -6,6 +6,7 @@ matrix_bot_matrix_reminder_bot_enabled: true
matrix_bot_matrix_reminder_bot_container_image_self_build: false
matrix_bot_matrix_reminder_bot_docker_repo: "https://github.com/anoadragon453/matrix-reminder-bot.git"
matrix_bot_matrix_reminder_bot_docker_repo_version: "{{ matrix_bot_matrix_reminder_bot_version }}"
matrix_bot_matrix_reminder_bot_docker_src_files_path: "{{ matrix_base_data_path }}/matrix-reminder-bot/docker-src"
matrix_bot_matrix_reminder_bot_version: release-v0.2.1

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

@ -1,22 +1,22 @@
---
- import_tasks: "{{ role_path }}/tasks/init.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
tags:
- always
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup | bool and matrix_bot_matrix_reminder_bot_enabled | bool"
tags:
- setup-all
- setup-bot-matrix-reminder-bot
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup | bool and matrix_bot_matrix_reminder_bot_enabled | bool"
tags:
- setup-all
- setup-bot-matrix-reminder-bot
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup | bool and not matrix_bot_matrix_reminder_bot_enabled | bool"
tags:
- setup-all

@ -1,16 +1,16 @@
---
- set_fact:
- ansible.builtin.set_fact:
matrix_bot_matrix_reminder_bot_requires_restart: false
- block:
- name: Check if an SQLite database already exists
stat:
ansible.builtin.stat:
path: "{{ matrix_bot_matrix_reminder_bot_sqlite_database_path_local }}"
register: matrix_bot_matrix_reminder_bot_sqlite_database_path_local_stat_result
- block:
- set_fact:
- ansible.builtin.set_fact:
matrix_postgres_db_migration_request:
src: "{{ matrix_bot_matrix_reminder_bot_sqlite_database_path_local }}"
dst: "{{ matrix_bot_matrix_reminder_bot_database_connection_string }}"
@ -19,15 +19,17 @@
engine_old: 'sqlite'
systemd_services_to_stop: ['matrix-bot-matrix-reminder-bot.service']
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
- ansible.builtin.import_role:
name: matrix-postgres
tasks_from: migrate_db_to_postgres
- set_fact:
- ansible.builtin.set_fact:
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_database_engine == 'postgres'"
- name: Ensure matrix-reminder-bot paths exist
file:
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
mode: 0750
@ -53,8 +55,9 @@
until: result is not failed
- name: Ensure matrix-reminder-bot repository is present on self-build
git:
ansible.builtin.git:
repo: "{{ matrix_bot_matrix_reminder_bot_docker_repo }}"
version: "{{ matrix_bot_matrix_reminder_bot_docker_repo_version }}"
dest: "{{ matrix_bot_matrix_reminder_bot_docker_src_files_path }}"
force: "yes"
become: true
@ -75,7 +78,7 @@
when: "matrix_bot_matrix_reminder_bot_container_image_self_build | bool"
- 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) }}"
dest: "{{ matrix_bot_matrix_reminder_bot_config_path }}/config.yaml"
mode: 0644
@ -83,19 +86,19 @@
group: "{{ matrix_user_groupname }}"
- 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"
dest: "{{ matrix_systemd_path }}/matrix-bot-matrix-reminder-bot.service"
mode: 0644
register: matrix_bot_matrix_reminder_bot_systemd_service_result
- name: Ensure systemd reloaded after matrix-bot-matrix-reminder-bot.service installation
service:
ansible.builtin.service:
daemon_reload: true
when: "matrix_bot_matrix_reminder_bot_systemd_service_result.changed | bool"
- name: Ensure matrix-bot-matrix-reminder-bot.service restarted, if necessary
service:
ansible.builtin.service:
name: "matrix-bot-matrix-reminder-bot.service"
state: restarted
when: "matrix_bot_matrix_reminder_bot_requires_restart | bool"

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

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

@ -2,10 +2,10 @@
# See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070
# and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407
- 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"
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'] }}"
when: matrix_bot_mjolnir_enabled | bool

@ -1,22 +1,22 @@
---
- import_tasks: "{{ role_path }}/tasks/init.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
tags:
- always
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup | bool and matrix_bot_mjolnir_enabled | bool"
tags:
- setup-all
- setup-bot-mjolnir
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup | bool and matrix_bot_mjolnir_enabled | bool"
tags:
- setup-all
- setup-bot-mjolnir
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup | bool and not matrix_bot_mjolnir_enabled | bool"
tags:
- setup-all

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

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

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

@ -39,10 +39,10 @@ matrix_appservice_discord_appservice_url: 'http://matrix-appservice-discord:9005
matrix_appservice_discord_bridge_domain: "{{ matrix_domain }}"
# As of right now, the homeserver URL must be a public URL. See below.
matrix_appservice_discord_bridge_homeserverUrl: "{{ matrix_homeserver_url }}"
matrix_appservice_discord_bridge_disablePresence: false
matrix_appservice_discord_bridge_enableSelfServiceBridging: false
matrix_appservice_discord_bridge_disablePortalBridging: false
matrix_appservice_discord_bridge_homeserverUrl: "{{ matrix_homeserver_url }}" # noqa var-naming
matrix_appservice_discord_bridge_disablePresence: false # noqa var-naming
matrix_appservice_discord_bridge_enableSelfServiceBridging: false # noqa var-naming
matrix_appservice_discord_bridge_disablePortalBridging: false # noqa var-naming
# Database-related configuration fields.
#
@ -65,7 +65,7 @@ matrix_appservice_discord_database_name: 'matrix_appservice_discord'
# These 2 variables are what actually ends up in the bridge configuration.
# It's best if you don't change them directly, but rather redefine the sub-variables that constitute them.
matrix_appservice_discord_database_filename: "{{ matrix_appservice_discord_sqlite_database_path_in_container }}"
matrix_appservice_discord_database_connString: 'postgresql://{{ matrix_appservice_discord_database_username }}:{{ matrix_appservice_discord_database_password }}@{{ matrix_appservice_discord_database_hostname }}:{{ matrix_appservice_discord_database_port }}/{{ matrix_appservice_discord_database_name }}'
matrix_appservice_discord_database_connString: 'postgresql://{{ matrix_appservice_discord_database_username }}:{{ matrix_appservice_discord_database_password }}@{{ matrix_appservice_discord_database_hostname }}:{{ matrix_appservice_discord_database_port }}/{{ matrix_appservice_discord_database_name }}' # noqa var-naming
# Tells whether the bot should make use of "Privileged Gateway Intents".
@ -74,7 +74,7 @@ matrix_appservice_discord_database_connString: 'postgresql://{{ matrix_appservic
# by triggering all Intent checkboxes on a page like this: `https://discord.com/developers/applications/694448564151123988/bot`
#
# Learn more: https://gist.github.com/advaith1/e69bcc1cdd6d0087322734451f15aa2f
matrix_appservice_discord_auth_usePrivilegedIntents: false
matrix_appservice_discord_auth_usePrivilegedIntents: false # noqa var-naming
matrix_appservice_discord_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}"

@ -2,17 +2,17 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed
fail:
ansible.builtin.fail:
msg: >-
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)"
- set_fact:
- ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-discord.service'] }}"
when: matrix_appservice_discord_enabled | bool
# 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 | default([])

@ -1,22 +1,22 @@
---
- import_tasks: "{{ role_path }}/tasks/init.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
tags:
- always
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup | bool and matrix_appservice_discord_enabled | bool"
tags:
- setup-all
- setup-appservice-discord
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup | bool and matrix_appservice_discord_enabled | bool"
tags:
- setup-all
- setup-appservice-discord
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup | bool and not matrix_appservice_discord_enabled | bool"
tags:
- setup-all

@ -1,16 +1,16 @@
---
- set_fact:
- ansible.builtin.set_fact:
matrix_appservice_discord_requires_restart: false
- block:
- name: Check if an SQLite database already exists
stat:
ansible.builtin.stat:
path: "{{ matrix_appservice_discord_sqlite_database_path_local }}"
register: matrix_appservice_discord_sqlite_database_path_local_stat_result
- block:
- set_fact:
- ansible.builtin.set_fact:
matrix_postgres_db_migration_request:
src: "{{ matrix_appservice_discord_sqlite_database_path_local }}"
dst: "{{ matrix_appservice_discord_database_connString }}"
@ -19,9 +19,11 @@
engine_old: 'sqlite'
systemd_services_to_stop: ['matrix-appservice-discord.service']
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
- ansible.builtin.import_role:
name: matrix-postgres
tasks_from: migrate_db_to_postgres
- set_fact:
- ansible.builtin.set_fact:
matrix_appservice_discord_requires_restart: true
when: "matrix_appservice_discord_sqlite_database_path_local_stat_result.stat.exists | bool"
when: "matrix_appservice_discord_database_engine == 'postgres'"
@ -38,7 +40,7 @@
until: result is not failed
- name: Ensure AppService Discord paths exist
file:
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: 0750
@ -50,12 +52,12 @@
- "{{ matrix_appservice_discord_data_path }}"
- name: Check if an old database file already exists
stat:
ansible.builtin.stat:
path: "{{ matrix_appservice_discord_base_path }}/discord.db"
register: matrix_appservice_discord_stat_db
- name: (Data relocation) Ensure matrix-appservice-discord.service is stopped
service:
ansible.builtin.service:
name: matrix-appservice-discord
state: stopped
enabled: false
@ -64,7 +66,7 @@
when: "matrix_appservice_discord_stat_db.stat.exists"
- 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:
- discord.db
- user-store.db
@ -72,7 +74,7 @@
when: "matrix_appservice_discord_stat_db.stat.exists"
- name: Ensure AppService Discord config.yaml installed
copy:
ansible.builtin.copy:
content: "{{ matrix_appservice_discord_configuration | to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_appservice_discord_config_path }}/config.yaml"
mode: 0644
@ -80,7 +82,7 @@
group: "{{ matrix_user_groupname }}"
- name: Ensure AppService Discord registration.yaml installed
copy:
ansible.builtin.copy:
content: "{{ matrix_appservice_discord_registration | to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_appservice_discord_config_path }}/registration.yaml"
mode: 0644
@ -90,7 +92,7 @@
# If `matrix_appservice_discord_client_id` hasn't changed, the same invite link would be generated.
# We intentionally suppress Ansible changes.
- name: Generate AppService Discord invite link
shell: >-
ansible.builtin.shell: >-
{{ matrix_host_command_docker }} run --rm --name matrix-appservice-discord-link-gen
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
--cap-drop=ALL
@ -101,19 +103,19 @@
changed_when: false
- name: Ensure matrix-appservice-discord.service installed
template:
ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-appservice-discord.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-appservice-discord.service"
mode: 0644
register: matrix_appservice_discord_systemd_service_result
- name: Ensure systemd reloaded after matrix-appservice-discord.service installation
service:
ansible.builtin.service:
daemon_reload: true
when: "matrix_appservice_discord_systemd_service_result.changed"
- name: Ensure matrix-appservice-discord.service restarted, if necessary
service:
ansible.builtin.service:
name: "matrix-appservice-discord.service"
state: restarted
when: "matrix_appservice_discord_requires_restart | bool"

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

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

@ -6,10 +6,14 @@ matrix_appservice_irc_enabled: true
matrix_appservice_irc_container_image_self_build: false
matrix_appservice_irc_docker_repo: "https://github.com/matrix-org/matrix-appservice-irc.git"
matrix_appservice_irc_docker_repo_version: "{{ 'master' if matrix_appservice_irc_version == 'latest' else matrix_appservice_irc_version }}"
matrix_appservice_irc_docker_src_files_path: "{{ matrix_base_data_path }}/appservice-irc/docker-src"
matrix_appservice_irc_version: release-0.34.0
matrix_appservice_irc_docker_image: "{{ matrix_container_global_registry_prefix }}matrixdotorg/matrix-appservice-irc:{{ matrix_appservice_irc_version }}"
# matrix_appservice_irc_version used to contain the full Docker image tag (e.g. `release-X.X.X`).
# It's a bare version number now. We try to somewhat retain compatibility below.
matrix_appservice_irc_version: 0.34.0
matrix_appservice_irc_docker_image: "{{ matrix_container_global_registry_prefix }}matrixdotorg/matrix-appservice-irc:{{ matrix_appservice_irc_docker_image_tag }}"
matrix_appservice_irc_docker_image_tag: "{{ 'latest' if matrix_appservice_irc_version == 'latest' else ('release-' + matrix_appservice_irc_version) }}"
matrix_appservice_irc_docker_image_force_pull: "{{ matrix_appservice_irc_docker_image.endswith(':latest') }}"
matrix_appservice_irc_base_path: "{{ matrix_base_data_path }}/appservice-irc"
@ -19,7 +23,7 @@ matrix_appservice_irc_data_path: "{{ matrix_appservice_irc_base_path }}/data"
matrix_appservice_irc_homeserver_url: "{{ matrix_homeserver_container_url }}"
matrix_appservice_irc_homeserver_media_url: 'https://{{ matrix_server_fqn_matrix }}'
matrix_appservice_irc_homeserver_domain: '{{ matrix_domain }}'
matrix_appservice_irc_homeserver_enablePresence: true
matrix_appservice_irc_homeserver_enablePresence: true # noqa var-naming
matrix_appservice_irc_appservice_address: 'http://matrix-appservice-irc:9999'
matrix_appservice_irc_database_engine: nedb
@ -34,14 +38,15 @@ matrix_appservice_irc_database_name: matrix_appservice_irc
matrix_appservice_irc_database_connection_string: 'postgresql://{{ matrix_appservice_irc_database_username }}:{{ matrix_appservice_irc_database_password }}@{{ matrix_appservice_irc_database_hostname }}:{{ matrix_appservice_irc_database_port }}/{{ matrix_appservice_irc_database_name }}?sslmode=disable'
# This is what actually goes into `database.connectionString` for the bridge.
matrix_appservice_irc_database_connectionString: "{{
matrix_appservice_irc_database_connectionString: |- # noqa var-naming
{{
{
'nedb': 'nedb:///data',
'postgres': matrix_appservice_irc_database_connection_string,
}[matrix_appservice_irc_database_engine]
}}"
}}
matrix_appservice_irc_ircService_servers: []
matrix_appservice_irc_ircService_servers: [] # noqa var-naming
# Example of `matrix_appservice_irc_ircService_servers` with one server (and all its options):
#

@ -2,24 +2,24 @@
# See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070
# and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407
- 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"
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.
# We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed
fail:
ansible.builtin.fail:
msg: >-
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)"
- set_fact:
- ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-irc.service'] }}"
when: matrix_appservice_irc_enabled | bool
# 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 | default([])

@ -1,22 +1,22 @@
---
- import_tasks: "{{ role_path }}/tasks/init.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
tags:
- always
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup | bool and matrix_appservice_irc_enabled | bool"
tags:
- setup-all
- setup-appservice-irc
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup | bool and matrix_appservice_irc_enabled | bool"
tags:
- setup-all
- setup-appservice-irc
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup | bool and not matrix_appservice_irc_enabled | bool"
tags:
- setup-all

@ -1,46 +1,46 @@
---
- 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."
when: "not matrix_postgres_enabled | bool"
# Defaults
- name: Set postgres_start_wait_time, if not provided
set_fact:
ansible.builtin.set_fact:
postgres_start_wait_time: 15
when: "postgres_start_wait_time | default('') == ''"
# Actual import work
- name: Ensure matrix-postgres is started
service:
ansible.builtin.service:
name: matrix-postgres
state: started
daemon_reload: true
register: matrix_postgres_service_start_result
- name: Wait a bit, so that Postgres can start
wait_for:
ansible.builtin.wait_for:
timeout: "{{ postgres_start_wait_time }}"
delegate_to: 127.0.0.1
become: false
when: "matrix_postgres_service_start_result.changed | bool"
- name: Check existence of matrix-appservice-irc service
stat:
ansible.builtin.stat:
path: "{{ matrix_systemd_path }}/matrix-appservice-irc.service"
register: matrix_appservice_irc_service_stat
- name: Ensure matrix-appservice-irc is stopped
service:
ansible.builtin.service:
name: matrix-appservice-irc
state: stopped
when: "matrix_appservice_irc_service_stat.stat.exists"
- name: Import appservice-irc NeDB database into Postgres
command:
ansible.builtin.command:
cmd: >-
{{ matrix_host_command_docker }} run
--rm
@ -52,16 +52,20 @@
{{ matrix_appservice_irc_docker_image }}
-c
'/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 }}'
register: matrix_appservice_irc_import_nedb_to_postgres_result
changed_when: matrix_appservice_irc_import_nedb_to_postgres_result.rc == 0
- name: Archive NeDB database files
command:
ansible.builtin.command:
cmd: "mv {{ matrix_appservice_irc_data_path }}/{{ item }} {{ matrix_appservice_irc_data_path }}/{{ item }}.backup"
with_items:
- rooms.db
- users.db
register: matrix_appservice_irc_import_nedb_to_postgres_move_result
changed_when: matrix_appservice_irc_import_nedb_to_postgres_move_result.rc == 0
- name: Inject result
set_fact:
ansible.builtin.set_fact:
matrix_playbook_runtime_results: |
{{
matrix_playbook_runtime_results | default([])

@ -1,9 +1,9 @@
---
- import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml"
- name: Ensure Appservice IRC paths exist
file:
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
mode: 0750
@ -17,42 +17,48 @@
when: item.when | bool
- name: Check if an old passkey file already exists
stat:
ansible.builtin.stat:
path: "{{ matrix_appservice_irc_base_path }}/passkey.pem"
register: matrix_appservice_irc_stat_passkey
- block:
- name: (Data relocation) Ensure matrix-appservice-irc.service is stopped
service:
ansible.builtin.service:
name: matrix-appservice-irc
state: stopped
daemon_reload: true
failed_when: false
- 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:
cmd: "mv {{ matrix_appservice_irc_base_path }}/passkey.pem {{ matrix_appservice_irc_data_path }}/passkey.pem"
register: matrix_appservice_irc_move_passkey_result
changed_when: matrix_appservice_irc_move_passkey_result.rc == 0
- 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:
cmd: "mv {{ matrix_appservice_irc_base_path }}/{{ item }} {{ matrix_appservice_irc_data_path }}/{{ item }}"
register: matrix_appservice_irc_move_dbs_result
changed_when: matrix_appservice_irc_move_dbs_result.rc == 0
with_items:
- rooms.db
- users.db
failed_when: false
when: "matrix_appservice_irc_stat_passkey.stat.exists"
- set_fact:
- ansible.builtin.set_fact:
matrix_appservice_irc_requires_restart: false
- block:
- name: Check if a nedb database already exists
stat:
ansible.builtin.stat:
path: "{{ matrix_appservice_irc_data_path }}/users.db"
register: matrix_appservice_irc_nedb_database_path_local_stat_result
- block:
- import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml"
- set_fact:
- ansible.builtin.set_fact:
matrix_appservice_irc_requires_restart: true
when: "matrix_appservice_irc_nedb_database_path_local_stat_result.stat.exists | bool"
when: "matrix_appservice_irc_database_engine == 'postgres'"
@ -70,8 +76,9 @@
until: result is not failed
- name: Ensure matrix-appservice-irc repository is present when self-building
git:
ansible.builtin.git:
repo: "{{ matrix_appservice_irc_docker_repo }}"
version: "{{ matrix_appservice_irc_docker_repo_version }}"
dest: "{{ matrix_appservice_irc_docker_src_files_path }}"
force: "yes"
become: true
@ -92,7 +99,7 @@
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
copy:
ansible.builtin.copy:
content: "{{ matrix_appservice_irc_configuration | to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_appservice_irc_config_path }}/config.yaml"
mode: 0644
@ -100,12 +107,12 @@
group: "{{ matrix_user_groupname }}"
- name: Check if Appservice IRC passkey exists
stat:
ansible.builtin.stat:
path: "{{ matrix_appservice_irc_data_path }}/passkey.pem"
register: irc_passkey_file
- 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_user: "{{ matrix_user_username }}"
when: "not irc_passkey_file.stat.exists"
@ -113,7 +120,7 @@
# In the past, we used to generate the passkey.pem file with root, so permissions may not be okay.
# Fix it.
- name: (Migration) Ensure Appservice IRC passkey permissions are okay
file:
ansible.builtin.file:
path: "{{ matrix_appservice_irc_data_path }}/passkey.pem"
mode: 0644
owner: "{{ matrix_user_username }}"
@ -139,7 +146,7 @@
# 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.
- name: Generate Appservice IRC registration-template.yaml
shell: >-
ansible.builtin.shell: >-
{{ matrix_host_command_docker }} run --rm --name matrix-appservice-irc-gen
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
--cap-drop=ALL
@ -157,26 +164,26 @@
changed_when: false
- name: Read Appservice IRC registration-template.yaml
slurp:
ansible.builtin.slurp:
src: "{{ matrix_appservice_irc_config_path }}/registration-template.yaml"
register: matrix_appservice_irc_registration_template_slurp
- name: Remove unnecessary Appservice IRC registration-template.yaml
file:
ansible.builtin.file:
path: "{{ matrix_appservice_irc_config_path }}/registration-template.yaml"
state: absent
changed_when: false
- 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 }}"
- 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) }}"
- name: Ensure Appservice IRC registration.yaml installed
copy:
ansible.builtin.copy:
content: "{{ matrix_appservice_irc_registration | to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_appservice_irc_config_path }}/registration.yaml"
mode: 0644
@ -184,19 +191,19 @@
group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-appservice-irc.service installed
template:
ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-appservice-irc.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-appservice-irc.service"
mode: 0644
register: matrix_appservice_irc_systemd_service_result
- name: Ensure systemd reloaded after matrix-appservice-irc.service installation
service:
ansible.builtin.service:
daemon_reload: true
when: "matrix_appservice_irc_systemd_service_result.changed"
- name: Ensure matrix-appservice-irc.service restarted, if necessary
service:
ansible.builtin.service:
name: "matrix-appservice-irc.service"
state: restarted
when: "matrix_appservice_irc_requires_restart | bool"

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

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

@ -6,10 +6,14 @@ matrix_appservice_slack_enabled: true
matrix_appservice_slack_container_image_self_build: false
matrix_appservice_slack_docker_repo: "https://github.com/matrix-org/matrix-appservice-slack.git"
matrix_appservice_slack_docker_repo_version: "{{ 'master' if matrix_appservice_slack_version == 'latest' else matrix_appservice_slack_version }}"
matrix_appservice_slack_docker_src_files_path: "{{ matrix_base_data_path }}/appservice-slack/docker-src"
matrix_appservice_slack_version: release-1.11.0
matrix_appservice_slack_docker_image: "{{ matrix_container_global_registry_prefix }}matrixdotorg/matrix-appservice-slack:{{ matrix_appservice_slack_version }}"
# matrix_appservice_slack_version used to contain the full Docker image tag (e.g. `release-X.X.X`).
# It's a bare version number now. We try to somewhat retain compatibility below.
matrix_appservice_slack_version: 1.11.0
matrix_appservice_slack_docker_image: "{{ matrix_container_global_registry_prefix }}matrixdotorg/matrix-appservice-slack:{{ matrix_appservice_slack_docker_image_tag }}"
matrix_appservice_slack_docker_image_tag: "{{ 'latest' if matrix_appservice_slack_version == 'latest' else ('release-' + matrix_appservice_slack_version) }}"
matrix_appservice_slack_docker_image_force_pull: "{{ matrix_appservice_slack_docker_image.endswith(':latest') }}"
matrix_appservice_slack_base_path: "{{ matrix_base_data_path }}/appservice-slack"
@ -63,12 +67,13 @@ matrix_appservice_slack_database_name: matrix_appservice_slack
matrix_appservice_slack_database_connection_string: 'postgresql://{{ matrix_appservice_slack_database_username }}:{{ matrix_appservice_slack_database_password }}@{{ matrix_appservice_slack_database_hostname }}:{{ matrix_appservice_slack_database_port }}/{{ matrix_appservice_slack_database_name }}?sslmode=disable'
# This is what actually goes into `database.connectionString` for the bridge.
matrix_appservice_slack_database_connectionString: "{{
matrix_appservice_slack_database_connectionString: |- # noqa var-naming
{{
{
'nedb': 'nedb:///data',
'postgres': matrix_appservice_slack_database_connection_string,
}[matrix_appservice_slack_database_engine]
}}"
}}
matrix_appservice_slack_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}"

@ -2,24 +2,24 @@
# See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070
# and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407
- 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"
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.
# We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed
fail:
ansible.builtin.fail:
msg: >-
The matrix-bridge-appservice-slack role needs to execute before the matrix-synapse role.
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'] }}"
when: matrix_appservice_slack_enabled | bool
# 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 | default([])
@ -38,14 +38,14 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed
fail:
ansible.builtin.fail:
msg: >-
The matrix-bridge-appservice-slack role needs to execute before the matrix-synapse role.
when: "matrix_synapse_role_executed | default(False)"
- block:
- name: Fail if matrix-nginx-proxy role already executed
fail:
ansible.builtin.fail:
msg: >-
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.
@ -54,7 +54,7 @@
when: matrix_nginx_proxy_role_executed | default(False) | bool
- name: Generate Matrix Appservice Slack proxying configuration for matrix-nginx-proxy
set_fact:
ansible.builtin.set_fact:
matrix_appservice_slack_matrix_nginx_proxy_configuration: |
location {{ matrix_appservice_slack_public_endpoint }} {
{% if matrix_nginx_proxy_enabled | default(False) %}
@ -69,7 +69,7 @@
}
- 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 | default([])
@ -81,7 +81,7 @@
when: matrix_appservice_slack_enabled | bool
- name: Warn about reverse-proxying if matrix-nginx-proxy not used
debug:
ansible.builtin.debug:
msg: >-
NOTE: You've enabled the Matrix Slack bridge but are not using the matrix-nginx-proxy
reverse proxy.

@ -1,22 +1,22 @@
---
- import_tasks: "{{ role_path }}/tasks/init.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
tags:
- always
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup | bool and matrix_appservice_slack_enabled | bool"
tags:
- setup-all
- setup-appservice-slack
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup | bool and matrix_appservice_slack_enabled | bool"
tags:
- setup-all
- setup-appservice-slack
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup | bool and not matrix_appservice_slack_enabled | bool"
tags:
- setup-all

@ -1,40 +1,40 @@
---
- 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."
when: "not matrix_postgres_enabled | bool"
# Defaults
- name: Set postgres_start_wait_time, if not provided
set_fact:
ansible.builtin.set_fact:
postgres_start_wait_time: 15
when: "postgres_start_wait_time | default('') == ''"
# Actual import work
- name: Ensure matrix-postgres is started
service:
ansible.builtin.service:
name: matrix-postgres
state: started
daemon_reload: true
register: matrix_postgres_service_start_result
- name: Wait a bit, so that Postgres can start
wait_for:
ansible.builtin.wait_for:
timeout: "{{ postgres_start_wait_time }}"
delegate_to: 127.0.0.1
become: false
when: "matrix_postgres_service_start_result.changed | bool"
- name: Ensure matrix-appservice-slack is stopped
service:
ansible.builtin.service:
name: matrix-appservice-slack
state: stopped
- name: Import appservice-slack NeDB database into Postgres
command:
ansible.builtin.command:
cmd: >-
{{ matrix_host_command_docker }} run
--rm
@ -46,10 +46,14 @@
{{ matrix_appservice_slack_docker_image }}
-c
'/usr/local/bin/node /usr/src/app/lib/scripts/migrateToPostgres.js --dbdir /data --connectionString {{ matrix_appservice_slack_database_connection_string }}'
register: matrix_appservice_slack_import_nedb_to_postgres_result
changed_when: matrix_appservice_slack_import_nedb_to_postgres_result.rc == 0
- name: Archive NeDB database files
command:
ansible.builtin.command:
cmd: "mv {{ matrix_appservice_slack_data_path }}/{{ item }} {{ matrix_appservice_slack_data_path }}/{{ item }}.backup"
register: matrix_appservice_slack_import_nedb_to_postgres_move_result
changed_when: matrix_appservice_slack_import_nedb_to_postgres_move_result.rc == 0
with_items:
- teams.db
- room-store.db
@ -57,7 +61,7 @@
- event-store.db
- name: Inject result
set_fact:
ansible.builtin.set_fact:
matrix_playbook_runtime_results: |
{{
matrix_playbook_runtime_results | default([])

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

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

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

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

@ -1,22 +1,22 @@
---
- import_tasks: "{{ role_path }}/tasks/init.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
tags:
- always
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup | bool and matrix_appservice_webhooks_enabled | bool"
tags:
- setup-all
- setup-appservice-webhooks
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup | bool and matrix_appservice_webhooks_enabled | bool"
tags:
- setup-all
- setup-appservice-webhooks
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup | bool and not matrix_appservice_webhooks_enabled | bool"
tags:
- setup-all

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

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

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

@ -1,11 +1,11 @@
---
- set_fact:
- ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-beeper-linkedin.service'] }}"
when: matrix_beeper_linkedin_enabled | bool
# 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 | default([])

@ -1,22 +1,22 @@
---
- import_tasks: "{{ role_path }}/tasks/init.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
tags:
- always
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup | bool and matrix_beeper_linkedin_enabled | bool"
tags:
- setup-all
- setup-beeper-linkedin
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup and matrix_beeper_linkedin_enabled"
tags:
- setup-all
- setup-beeper-linkedin
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup and not matrix_beeper_linkedin_enabled"
tags:
- setup-all

@ -3,12 +3,12 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed
fail:
ansible.builtin.fail:
msg: >-
The matrix-bridge-beeper-linkedin role needs to execute before the matrix-synapse role.
when: "matrix_synapse_role_executed | default(False)"
- name: Ensure Beeper LinkedIn paths exists
file:
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
mode: 0750
@ -36,7 +36,7 @@
- block:
- name: Ensure Beeper LinkedIn repository is present on self-build
git:
ansible.builtin.git:
repo: "{{ matrix_beeper_linkedin_container_image_self_build_repo }}"
dest: "{{ matrix_beeper_linkedin_docker_src_files_path }}"
version: "{{ matrix_beeper_linkedin_container_image_self_build_branch }}"
@ -48,7 +48,8 @@
# 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
- name: Ensure docker-requirements.txt is generated before building Beeper LinkedIn Docker Image
command: |
ansible.builtin.command:
cmd: |
{{ matrix_host_command_docker }} run \
--rm \
--entrypoint=/bin/sh \
@ -56,6 +57,8 @@
-w /work \
docker.io/python:3.9.6-buster \
-c "pip install poetry && poetry export --without-hashes -E e2be -E images -E metrics | sed 's/==.*//g' > docker-requirements.txt"
register: matrix_beeper_linkedin_generate_docker_requirements_result
changed_when: matrix_beeper_linkedin_generate_docker_requirements_result.rc == 0
- name: Ensure Beeper LinkedIn Docker image is built
docker_image:
@ -72,7 +75,7 @@
when: "matrix_beeper_linkedin_container_image_self_build | bool"
- name: Ensure beeper-linkedin config.yaml installed
copy:
ansible.builtin.copy:
content: "{{ matrix_beeper_linkedin_configuration | to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_beeper_linkedin_config_path }}/config.yaml"
mode: 0644
@ -80,7 +83,7 @@
group: "{{ matrix_user_groupname }}"
- name: Ensure beeper-linkedin registration.yaml installed
copy:
ansible.builtin.copy:
content: "{{ matrix_beeper_linkedin_registration | to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_beeper_linkedin_config_path }}/registration.yaml"
mode: 0644
@ -88,13 +91,13 @@
group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-beeper-linkedin.service installed
template:
ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-beeper-linkedin.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-beeper-linkedin.service"
mode: 0644
register: matrix_beeper_linkedin_systemd_service_result
- name: Ensure systemd reloaded after matrix-beeper-linkedin.service installation
service:
ansible.builtin.service:
daemon_reload: true
when: "matrix_beeper_linkedin_systemd_service_result.changed"

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

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

@ -1,10 +1,10 @@
---
- set_fact:
- ansible.builtin.set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-go-skype-bridge.service'] }}"
when: matrix_go_skype_bridge_enabled | bool
# 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 | default([])

@ -1,22 +1,22 @@
---
- import_tasks: "{{ role_path }}/tasks/init.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
tags:
- always
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup | bool and matrix_go_skype_bridge_enabled | bool"
tags:
- setup-all
- setup-go-skype-bridge
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup | bool and matrix_go_skype_bridge_enabled | bool"
tags:
- setup-all
- setup-go-skype-bridge
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup | bool and not matrix_go_skype_bridge_enabled | bool"
tags:
- setup-all

@ -3,22 +3,22 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed
fail:
ansible.builtin.fail:
msg: >-
The matrix-bridge-go-skype-bridge role needs to execute before the matrix-synapse role.
when: "matrix_synapse_role_executed | default(False)"
- set_fact:
- ansible.builtin.set_fact:
matrix_go_skype_bridge_requires_restart: false
- block:
- name: Check if an SQLite database already exists
stat:
ansible.builtin.stat:
path: "{{ matrix_go_skype_bridge_sqlite_database_path_local }}"
register: matrix_go_skype_bridge_sqlite_database_path_local_stat_result
- block:
- set_fact:
- ansible.builtin.set_fact:
matrix_postgres_db_migration_request:
src: "{{ matrix_go_skype_bridge_sqlite_database_path_local }}"
dst: "{{ matrix_go_skype_bridge_database_connection_string }}"
@ -28,16 +28,18 @@
systemd_services_to_stop: ['matrix-go-skype-bridge.service']
pgloader_options: ['--with "quote identifiers"']
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
- ansible.builtin.import_role:
name: matrix-postgres
tasks_from: migrate_db_to_postgres
- set_fact:
- ansible.builtin.set_fact:
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_database_engine == 'postgres'"
- name: Ensure Go Skype Bridge paths exists
file:
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
mode: 0750
@ -63,7 +65,7 @@
until: result is not failed
- 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 }}"
dest: "{{ matrix_go_skype_bridge_docker_src_files_path }}"
version: "{{ matrix_go_skype_bridge_container_image_self_build_branch }}"
@ -86,17 +88,17 @@
when: "matrix_go_skype_bridge_container_image_self_build | bool"
- name: Check if an old database file exists
stat:
ansible.builtin.stat:
path: "{{ matrix_go_skype_bridge_base_path }}/go-skype-bridge.db"
register: matrix_go_skype_bridge_stat_database
- name: Check if an old matrix state file exists
stat:
ansible.builtin.stat:
path: "{{ matrix_go_skype_bridge_base_path }}/mx-state.json"
register: matrix_go_skype_bridge_stat_mx_state
- name: (Data relocation) Ensure matrix-go-skype-bridge.service is stopped
service:
ansible.builtin.service:
name: matrix-go-skype-bridge
state: stopped
enabled: false
@ -105,15 +107,15 @@
when: "matrix_go_skype_bridge_stat_database.stat.exists"
- 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"
- 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"
- 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) }}"
dest: "{{ matrix_go_skype_bridge_config_path }}/config.yaml"
mode: 0644
@ -121,7 +123,7 @@
group: "{{ matrix_user_groupname }}"
- 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) }}"
dest: "{{ matrix_go_skype_bridge_config_path }}/registration.yaml"
mode: 0644
@ -129,19 +131,19 @@
group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-go-skype-bridge.service installed
template:
ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-go-skype-bridge.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-go-skype-bridge.service"
mode: 0644
register: matrix_go_skype_bridge_systemd_service_result
- name: Ensure systemd reloaded after matrix-go-skype-bridge.service installation
service:
ansible.builtin.service:
daemon_reload: true
when: "matrix_go_skype_bridge_systemd_service_result.changed"
- name: Ensure matrix-go-skype-bridge.service restarted, if necessary
service:
ansible.builtin.service:
name: "matrix-go-skype-bridge.service"
state: restarted
when: "matrix_go_skype_bridge_requires_restart | bool"

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

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

@ -2,17 +2,17 @@
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
# We don't want to fail in such cases.
- name: Fail if matrix-synapse role already executed
fail:
ansible.builtin.fail:
msg: >-
The matrix-bridge-heisenbridge role needs to execute before the matrix-synapse role.
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'] }}"
when: matrix_heisenbridge_enabled | bool
# 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 | default([])

@ -1,16 +1,16 @@
---
- import_tasks: "{{ role_path }}/tasks/init.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
tags:
- always
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup | bool and matrix_heisenbridge_enabled | bool"
tags:
- setup-all
- setup-heisenbridge
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup | bool and not matrix_heisenbridge_enabled | bool"
tags:
- setup-all

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

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

@ -72,7 +72,7 @@ matrix_hookshot_github_oauth_uri: "{{ matrix_hookshot_urlprefix }}{{ matrix_hook
# These are the default settings mentioned here and don't need to be modified: https://matrix-org.github.io/matrix-hookshot/usage/room_configuration/github_repo.html#configuration
matrix_hookshot_github_ignore_hooks: "{}"
matrix_hookshot_github_command_prefix: '!gh'
matrix_hookshot_github_showIssueRoomLink: false
matrix_hookshot_github_showIssueRoomLink: false # noqa var-naming
matrix_hookshot_github_pr_diff: "{enabled: false, maxLines: 5}"
matrix_hookshot_github_including_labels: ''
matrix_hookshot_github_excluding_labels: ''
@ -97,7 +97,7 @@ matrix_hookshot_gitlab_secret: ''
matrix_hookshot_figma_enabled: false
# Default value of matrix_hookshot_figma_endpoint: "/hookshot/webhooks/figma/webhook"
matrix_hookshot_figma_endpoint: "{{ matrix_hookshot_webhook_endpoint }}/figma/webhook"
matrix_hookshot_figma_publicUrl: "{{ matrix_hookshot_urlprefix }}{{ matrix_hookshot_figma_endpoint }}"
matrix_hookshot_figma_publicUrl: "{{ matrix_hookshot_urlprefix }}{{ matrix_hookshot_figma_endpoint }}" # noqa var-naming
# To bridge figma webhooks, you need to configure one of multiple instances like this:
# matrix_hookshot_figma_instances:
# your-instance:
@ -144,9 +144,9 @@ matrix_hookshot_provisioning_endpoint: "{{ matrix_hookshot_public_endpoint }}{{
matrix_hookshot_widgets_enabled: true
matrix_hookshot_widgets_port: 9003
matrix_hookshot_widgets_addToAdminRooms: false # default off as it is a beta feature
matrix_hookshot_widgets_roomSetupWidget_enabled: true
matrix_hookshot_widgets_roomSetupWidget_addOnInvite: false
matrix_hookshot_widgets_addToAdminRooms: false # default off as it is a beta feature # noqa var-naming
matrix_hookshot_widgets_roomSetupWidget_enabled: true # noqa var-naming
matrix_hookshot_widgets_roomSetupWidget_addOnInvite: false # noqa var-naming
# `disallowedIpRanges` describes which IP ranges should be disallowed when resolving homeserver IP addresses (for security reasons). Unless you know what you are doing, it is recommended to not include this key. The following IPs are blocked by default, unless you supply another list.
# matrix_hookshot_widgets_disallowedIpRanges:
# - 127.0.0.0/8
@ -168,12 +168,12 @@ matrix_hookshot_widgets_roomSetupWidget_addOnInvite: false
# - 2001:db8::/32
# - ff00::/8
# - fec0::/10
matrix_hookshot_widgets_disallowedIpRanges: ''
matrix_hookshot_widgets_disallowedIpRanges: '' # noqa var-naming
matrix_hookshot_widgets_internal: "/widgetapi"
# Default value of matrix_hookshot_widgets_endpoint: "/hookshot/widgetapi"
matrix_hookshot_widgets_endpoint: "{{ matrix_hookshot_public_endpoint }}{{ matrix_hookshot_widgets_internal }}"
matrix_hookshot_widgets_publicUrl: "{{ matrix_hookshot_urlprefix }}{{ matrix_hookshot_widgets_endpoint }}/v1/static"
matrix_hookshot_widgets_branding_widgetTitle: "Hookshot Configuration"
matrix_hookshot_widgets_publicUrl: "{{ matrix_hookshot_urlprefix }}{{ matrix_hookshot_widgets_endpoint }}/v1/static" # noqa var-naming
matrix_hookshot_widgets_branding_widgetTitle: "Hookshot Configuration" # noqa var-naming
# You can configure access to the bridge as documented here https://matrix-org.github.io/matrix-hookshot/setup.html#permissions

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

Loading…
Cancel
Save