Merge branch 'master' into signal
This commit is contained in:
@ -23,6 +23,17 @@ matrix_server_fqn_jitsi: "jitsi.{{ matrix_domain }}"
|
||||
|
||||
matrix_federation_public_port: 8448
|
||||
|
||||
# The architecture that your server runs.
|
||||
# Recognized values by us are 'amd64', 'arm32' and 'arm64'.
|
||||
# Not all architectures support all services, so your experience (on non-amd64) may vary.
|
||||
# See docs/alternative-architectures.md
|
||||
matrix_architecture: amd64
|
||||
|
||||
# The architecture for Debian packages.
|
||||
# See: https://wiki.debian.org/SupportedArchitectures
|
||||
# We just remap from our `matrix_architecture` values to what Debian and possibly other distros call things.
|
||||
matrix_debian_arch: "{{ 'armhf' if matrix_architecture == 'arm32' else matrix_architecture }}"
|
||||
|
||||
matrix_user_username: "matrix"
|
||||
matrix_user_groupname: "matrix"
|
||||
|
||||
@ -106,7 +117,6 @@ matrix_docker_package_name: docker-ce
|
||||
run_postgres_import: true
|
||||
run_postgres_upgrade: true
|
||||
run_postgres_import_sqlite_db: true
|
||||
run_postgres_synapse_janitor: true
|
||||
run_postgres_vacuum: true
|
||||
run_synapse_register_user: true
|
||||
run_synapse_update_user_password: true
|
||||
|
@ -1,62 +1,62 @@
|
||||
[docker-ce-stable]
|
||||
name=Docker CE Stable - $basearch
|
||||
baseurl=https://download.docker.com/linux/centos/7/$basearch/stable
|
||||
baseurl=https://download.docker.com/linux/centos/$releasever/$basearch/stable
|
||||
enabled=1
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-stable-debuginfo]
|
||||
name=Docker CE Stable - Debuginfo $basearch
|
||||
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/stable
|
||||
baseurl=https://download.docker.com/linux/centos/$releasever/debug-$basearch/stable
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-stable-source]
|
||||
name=Docker CE Stable - Sources
|
||||
baseurl=https://download.docker.com/linux/centos/7/source/stable
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-edge]
|
||||
name=Docker CE Edge - $basearch
|
||||
baseurl=https://download.docker.com/linux/centos/7/$basearch/edge
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-edge-debuginfo]
|
||||
name=Docker CE Edge - Debuginfo $basearch
|
||||
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/edge
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-edge-source]
|
||||
name=Docker CE Edge - Sources
|
||||
baseurl=https://download.docker.com/linux/centos/7/source/edge
|
||||
baseurl=https://download.docker.com/linux/centos/$releasever/source/stable
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-test]
|
||||
name=Docker CE Test - $basearch
|
||||
baseurl=https://download.docker.com/linux/centos/7/$basearch/test
|
||||
baseurl=https://download.docker.com/linux/centos/$releasever/$basearch/test
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-test-debuginfo]
|
||||
name=Docker CE Test - Debuginfo $basearch
|
||||
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/test
|
||||
baseurl=https://download.docker.com/linux/centos/$releasever/debug-$basearch/test
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-test-source]
|
||||
name=Docker CE Test - Sources
|
||||
baseurl=https://download.docker.com/linux/centos/7/source/test
|
||||
baseurl=https://download.docker.com/linux/centos/$releasever/source/test
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-nightly]
|
||||
name=Docker CE Nightly - $basearch
|
||||
baseurl=https://download.docker.com/linux/centos/$releasever/$basearch/nightly
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-nightly-debuginfo]
|
||||
name=Docker CE Nightly - Debuginfo $basearch
|
||||
baseurl=https://download.docker.com/linux/centos/$releasever/debug-$basearch/nightly
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-nightly-source]
|
||||
name=Docker CE Nightly - Sources
|
||||
baseurl=https://download.docker.com/linux/centos/$releasever/source/nightly
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
- name: Ensure Docker's APT key is trusted
|
||||
apt_key:
|
||||
url: https://download.docker.com/linux/ubuntu/gpg
|
||||
url: "https://download.docker.com/linux/{{ ansible_distribution|lower }}/gpg"
|
||||
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
|
||||
state: present
|
||||
register: add_repository_key
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
- name: Ensure Docker repository is enabled
|
||||
apt_repository:
|
||||
repo: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable"
|
||||
repo: "deb [arch={{ matrix_debian_arch }}] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable"
|
||||
state: present
|
||||
update_cache: yes
|
||||
when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce'
|
||||
|
@ -5,6 +5,7 @@
|
||||
name:
|
||||
- apt-transport-https
|
||||
- ca-certificates
|
||||
- gnupg
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
@ -19,7 +20,7 @@
|
||||
|
||||
- name: Ensure Docker repository is enabled
|
||||
apt_repository:
|
||||
repo: "deb [arch=armhf] https://download.docker.com/linux/raspbian {{ ansible_distribution_release }} stable"
|
||||
repo: "deb [arch={{ matrix_debian_arch }}] https://download.docker.com/linux/raspbian {{ ansible_distribution_release }} stable"
|
||||
state: present
|
||||
update_cache: yes
|
||||
when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce'
|
||||
@ -27,7 +28,6 @@
|
||||
- name: Ensure APT packages are installed
|
||||
apt:
|
||||
name:
|
||||
- python-docker
|
||||
- "{{ matrix_ntpd_package }}"
|
||||
- fuse
|
||||
state: latest
|
||||
@ -37,5 +37,6 @@
|
||||
apt:
|
||||
name:
|
||||
- "{{ matrix_docker_package_name }}"
|
||||
- "python{{'3' if ansible_python.version.major == 3 else ''}}-docker"
|
||||
state: latest
|
||||
when: matrix_docker_installation_enabled|bool
|
||||
|
@ -24,9 +24,9 @@ else
|
||||
find /etc/cron.d/ -name "matrix-*" -delete
|
||||
echo "Remove matrix scripts"
|
||||
find {{ matrix_local_bin_path }}/ -name "matrix-*" -delete
|
||||
echo "Remove every docker images"
|
||||
docker rmi $(docker images -aq)
|
||||
echo "Remove docker matrix network"
|
||||
echo "Remove unused Docker images and resources"
|
||||
docker system prune -af
|
||||
echo "Remove Docker matrix network (should be gone already, but ..)"
|
||||
docker network rm {{ matrix_docker_network }}
|
||||
echo "Remove {{ matrix_base_data_path }} directory"
|
||||
rm -fr "{{ matrix_base_data_path }}"
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
matrix_bot_matrix_reminder_bot_enabled: true
|
||||
|
||||
matrix_bot_matrix_reminder_bot_docker_image: "anoa/matrix-reminder-bot:release-v0.2.0"
|
||||
matrix_bot_matrix_reminder_bot_docker_image: "docker.io/anoa/matrix-reminder-bot:release-v0.2.0"
|
||||
matrix_bot_matrix_reminder_bot_docker_image_force_pull: "{{ matrix_bot_matrix_reminder_bot_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_bot_matrix_reminder_bot_base_path: "{{ matrix_base_data_path }}/matrix-reminder-bot"
|
||||
@ -21,6 +21,34 @@ matrix_bot_matrix_reminder_bot_systemd_required_services_list: ['docker.service'
|
||||
matrix_bot_matrix_reminder_bot_systemd_wanted_services_list: []
|
||||
|
||||
|
||||
# Database-related configuration fields.
|
||||
#
|
||||
# To use SQLite, stick to these defaults.
|
||||
#
|
||||
# To use Postgres:
|
||||
# - change the engine (`matrix_bot_matrix_reminder_bot_database_engine: 'postgres'`)
|
||||
# - adjust your database credentials via the `matrix_bot_matrix_reminder_bot_database_*` variables
|
||||
matrix_bot_matrix_reminder_bot_database_engine: 'sqlite'
|
||||
|
||||
matrix_bot_matrix_reminder_bot_sqlite_database_path_local: "{{ matrix_bot_matrix_reminder_bot_data_path }}/bot.db"
|
||||
matrix_bot_matrix_reminder_bot_sqlite_database_path_in_container: "/data/bot.db"
|
||||
|
||||
matrix_bot_matrix_reminder_bot_database_username: 'matrix_reminder_bot'
|
||||
matrix_bot_matrix_reminder_bot_database_password: 'some-password'
|
||||
matrix_bot_matrix_reminder_bot_database_hostname: 'matrix-postgres'
|
||||
matrix_bot_matrix_reminder_bot_database_port: 5432
|
||||
matrix_bot_matrix_reminder_bot_database_name: 'matrix_reminder_bot'
|
||||
|
||||
matrix_bot_matrix_reminder_bot_database_connection_string: 'postgres://{{ matrix_bot_matrix_reminder_bot_database_username }}:{{ matrix_bot_matrix_reminder_bot_database_password }}@{{ matrix_bot_matrix_reminder_bot_database_hostname }}:{{ matrix_bot_matrix_reminder_bot_database_port }}/{{ matrix_bot_matrix_reminder_bot_database_name }}'
|
||||
|
||||
matrix_bot_matrix_reminder_bot_storage_database: "{{
|
||||
{
|
||||
'sqlite': ('sqlite://' + matrix_bot_matrix_reminder_bot_sqlite_database_path_in_container),
|
||||
'postgres': matrix_bot_matrix_reminder_bot_database_connection_string,
|
||||
}[matrix_bot_matrix_reminder_bot_database_engine]
|
||||
}}"
|
||||
|
||||
|
||||
# The bot's username. This user needs to be created manually beforehand.
|
||||
# Also see `matrix_bot_matrix_reminder_bot_user_password`.
|
||||
matrix_bot_matrix_reminder_bot_matrix_user_id_localpart: "bot.matrix-reminder-bot"
|
||||
|
@ -8,7 +8,14 @@
|
||||
- setup-all
|
||||
- setup-bot-matrix-reminder-bot
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/setup.yml"
|
||||
- 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"
|
||||
when: "run_setup|bool and not matrix_bot_matrix_reminder_bot_enabled|bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-bot-matrix-reminder-bot
|
||||
|
@ -1,88 +0,0 @@
|
||||
---
|
||||
|
||||
#
|
||||
# Tasks related to setting up matrix-reminder-bot
|
||||
#
|
||||
|
||||
- name: Ensure matrix-reminder-bot paths exist
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- { path: "{{ matrix_bot_matrix_reminder_bot_config_path }}", when: true }
|
||||
- { path: "{{ matrix_bot_matrix_reminder_bot_data_path }}", when: true }
|
||||
- { path: "{{ matrix_bot_matrix_reminder_bot_data_store_path }}", when: true }
|
||||
when: matrix_bot_matrix_reminder_bot_enabled|bool and item.when
|
||||
|
||||
- name: Ensure matrix-reminder-bot image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_bot_matrix_reminder_bot_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_bot_matrix_reminder_bot_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_bot_matrix_reminder_bot_docker_image_force_pull }}"
|
||||
when: matrix_bot_matrix_reminder_bot_enabled|bool
|
||||
|
||||
- name: Ensure matrix-reminder-bot config installed
|
||||
copy:
|
||||
content: "{{ matrix_bot_matrix_reminder_bot_configuration|to_nice_yaml }}"
|
||||
dest: "{{ matrix_bot_matrix_reminder_bot_config_path }}/config.yaml"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
when: matrix_bot_matrix_reminder_bot_enabled|bool
|
||||
|
||||
- name: Ensure matrix-matrix-reminder-bot.service installed
|
||||
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
|
||||
when: matrix_bot_matrix_reminder_bot_enabled|bool
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-matrix-reminder-bot.service installation
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_bot_matrix_reminder_bot_enabled|bool and matrix_bot_matrix_reminder_bot_systemd_service_result.changed"
|
||||
|
||||
#
|
||||
# Tasks related to getting rid of matrix-reminder-bot (if it was previously enabled)
|
||||
#
|
||||
|
||||
- name: Check existence of matrix-matrix-reminder-bot service
|
||||
stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-matrix-reminder-bot.service"
|
||||
register: matrix_bot_matrix_reminder_bot_service_stat
|
||||
|
||||
- name: Ensure matrix-matrix-reminder-bot is stopped
|
||||
service:
|
||||
name: matrix-matrix-reminder-bot
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
register: stopping_result
|
||||
when: "not matrix_bot_matrix_reminder_bot_enabled|bool and matrix_bot_matrix_reminder_bot_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-matrix-reminder-bot.service doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-matrix-reminder-bot.service"
|
||||
state: absent
|
||||
when: "not matrix_bot_matrix_reminder_bot_enabled|bool and matrix_bot_matrix_reminder_bot_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-matrix-reminder-bot.service removal
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "not matrix_bot_matrix_reminder_bot_enabled|bool and matrix_bot_matrix_reminder_bot_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure Matrix matrix-reminder-bot paths don't exist
|
||||
file:
|
||||
path: "{{ matrix_bot_matrix_reminder_bot_base_path }}"
|
||||
state: absent
|
||||
when: "not matrix_bot_matrix_reminder_bot_enabled|bool"
|
||||
|
||||
- name: Ensure matrix-reminder-bot Docker image doesn't exist
|
||||
docker_image:
|
||||
name: "{{ matrix_bot_matrix_reminder_bot_docker_image }}"
|
||||
state: absent
|
||||
when: "not matrix_bot_matrix_reminder_bot_enabled|bool"
|
73
roles/matrix-bot-matrix-reminder-bot/tasks/setup_install.yml
Normal file
73
roles/matrix-bot-matrix-reminder-bot/tasks/setup_install.yml
Normal file
@ -0,0 +1,73 @@
|
||||
---
|
||||
|
||||
- set_fact:
|
||||
matrix_bot_matrix_reminder_bot_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
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:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_bot_matrix_reminder_bot_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_bot_matrix_reminder_bot_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_bot_matrix_reminder_bot_database_engine'
|
||||
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"
|
||||
|
||||
- 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:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- { path: "{{ matrix_bot_matrix_reminder_bot_config_path }}", when: true }
|
||||
- { path: "{{ matrix_bot_matrix_reminder_bot_data_path }}", when: true }
|
||||
- { path: "{{ matrix_bot_matrix_reminder_bot_data_store_path }}", when: true }
|
||||
when: "item.when|bool"
|
||||
|
||||
- name: Ensure matrix-reminder-bot image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_bot_matrix_reminder_bot_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_bot_matrix_reminder_bot_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_bot_matrix_reminder_bot_docker_image_force_pull }}"
|
||||
|
||||
- name: Ensure matrix-reminder-bot config installed
|
||||
copy:
|
||||
content: "{{ matrix_bot_matrix_reminder_bot_configuration|to_nice_yaml }}"
|
||||
dest: "{{ matrix_bot_matrix_reminder_bot_config_path }}/config.yaml"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
- name: Ensure matrix-bot-matrix-reminder-bot.service installed
|
||||
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:
|
||||
daemon_reload: yes
|
||||
when: "matrix_bot_matrix_reminder_bot_systemd_service_result.changed|bool"
|
||||
|
||||
- name: Ensure matrix-bot-matrix-reminder-bot.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-bot-matrix-reminder-bot.service"
|
||||
state: restarted
|
||||
when: "matrix_bot_matrix_reminder_bot_requires_restart|bool"
|
@ -0,0 +1,35 @@
|
||||
---
|
||||
|
||||
- name: Check existence of matrix-matrix-reminder-bot service
|
||||
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:
|
||||
name: matrix-matrix-reminder-bot
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
register: stopping_result
|
||||
when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists|bool"
|
||||
|
||||
- name: Ensure matrix-bot-matrix-reminder-bot.service doesn't exist
|
||||
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:
|
||||
daemon_reload: yes
|
||||
when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists|bool"
|
||||
|
||||
- name: Ensure Matrix matrix-reminder-bot paths don't exist
|
||||
file:
|
||||
path: "{{ matrix_bot_matrix_reminder_bot_base_path }}"
|
||||
state: absent
|
||||
|
||||
- name: Ensure matrix-reminder-bot Docker image doesn't exist
|
||||
docker_image:
|
||||
name: "{{ matrix_bot_matrix_reminder_bot_docker_image }}"
|
||||
state: absent
|
@ -23,7 +23,7 @@ storage:
|
||||
# For Postgres, this would look like:
|
||||
# database: "postgres://username:password@localhost/dbname?sslmode=disable"
|
||||
#database: "postgres://matrix-reminder-bot:remindme@localhost/matrix-reminder-bot?sslmode=disable"
|
||||
database: "sqlite:///data/bot.db"
|
||||
database: {{ matrix_bot_matrix_reminder_bot_storage_database|to_json }}
|
||||
# The path to a directory for internal bot storage
|
||||
# containing encryption keys, sync tokens, etc.
|
||||
store_path: "/data/store"
|
||||
|
@ -8,6 +8,7 @@ After={{ service }}
|
||||
{% for service in matrix_bot_matrix_reminder_bot_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
@ -21,8 +22,8 @@ ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-bot-matrix-rem
|
||||
--read-only \
|
||||
--network={{ matrix_docker_network }} \
|
||||
-e 'TZ={{ matrix_bot_matrix_reminder_bot_reminders_timezone }}' \
|
||||
-v {{ matrix_bot_matrix_reminder_bot_config_path }}:/config:ro \
|
||||
-v {{ matrix_bot_matrix_reminder_bot_data_path }}:/data:rw \
|
||||
--mount type=bind,src={{ matrix_bot_matrix_reminder_bot_config_path }},dst=/config,ro \
|
||||
--mount type=bind,src={{ matrix_bot_matrix_reminder_bot_data_path }},dst=/data \
|
||||
--entrypoint=/bin/sh \
|
||||
{% for arg in matrix_bot_matrix_reminder_bot_container_extra_arguments %}
|
||||
{{ arg }} \
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
matrix_appservice_discord_enabled: true
|
||||
|
||||
matrix_appservice_discord_docker_image: "halfshot/matrix-appservice-discord:latest"
|
||||
matrix_appservice_discord_docker_image: "docker.io/halfshot/matrix-appservice-discord:v1.0.0"
|
||||
matrix_appservice_discord_docker_image_force_pull: "{{ matrix_appservice_discord_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_appservice_discord_base_path: "{{ matrix_base_data_path }}/appservice-discord"
|
||||
@ -17,6 +17,8 @@ matrix_appservice_discord_bot_token: ''
|
||||
matrix_appservice_discord_appservice_token: ''
|
||||
matrix_appservice_discord_homeserver_token: ''
|
||||
|
||||
matrix_appservice_discord_homeserver_domain: "{{ matrix_domain }}"
|
||||
|
||||
# Controls whether the matrix-appservice-discord container exposes its HTTP port (tcp/9005 in the container).
|
||||
#
|
||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9005"), or empty string to not expose.
|
||||
@ -39,6 +41,38 @@ matrix_appservice_discord_bridge_homeserverUrl: "{{ matrix_homeserver_url }}"
|
||||
matrix_appservice_discord_bridge_disablePresence: false
|
||||
matrix_appservice_discord_bridge_enableSelfServiceBridging: false
|
||||
|
||||
# Database-related configuration fields.
|
||||
#
|
||||
# To use SQLite, stick to these defaults.
|
||||
#
|
||||
# To use Postgres:
|
||||
# - change the engine (`matrix_appservice_discord_database_engine: 'postgres'`)
|
||||
# - adjust your database credentials via the `matrix_appservice_discord_postgres_*` variables
|
||||
matrix_appservice_discord_database_engine: 'sqlite'
|
||||
|
||||
matrix_appservice_discord_sqlite_database_path_local: "{{ matrix_appservice_discord_data_path }}/discord.db"
|
||||
matrix_appservice_discord_sqlite_database_path_in_container: "/data/discord.db"
|
||||
|
||||
matrix_appservice_discord_database_username: 'matrix_appservice_discord'
|
||||
matrix_appservice_discord_database_password: 'some-password'
|
||||
matrix_appservice_discord_database_hostname: 'matrix-postgres'
|
||||
matrix_appservice_discord_database_port: 5432
|
||||
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 }}'
|
||||
|
||||
|
||||
# Tells whether the bot should make use of "Privileged Gateway Intents".
|
||||
#
|
||||
# Enabling this means that you need to enable it for the bot (Discord application) as well,
|
||||
# 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_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}"
|
||||
|
||||
matrix_appservice_discord_configuration_extension_yaml: |
|
||||
@ -62,10 +96,10 @@ matrix_appservice_discord_registration_yaml: |
|
||||
namespaces:
|
||||
users:
|
||||
- exclusive: true
|
||||
regex: '^@_discord_.*'
|
||||
regex: '@_discord_.*:{{ matrix_appservice_discord_homeserver_domain|regex_escape }}'
|
||||
aliases:
|
||||
- exclusive: true
|
||||
regex: '^#_discord_.*'
|
||||
regex: '#_discord_.*:{{ matrix_appservice_discord_homeserver_domain|regex_escape }}'
|
||||
url: {{ matrix_appservice_discord_appservice_url }}
|
||||
sender_localpart: _discord_bot
|
||||
rate_limited: false
|
||||
|
@ -1,5 +1,31 @@
|
||||
---
|
||||
|
||||
- set_fact:
|
||||
matrix_appservice_discord_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_appservice_discord_sqlite_database_path_local }}"
|
||||
register: matrix_appservice_discord_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_appservice_discord_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_appservice_discord_database_connString }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_appservice_discord_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-appservice-discord.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- 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'"
|
||||
|
||||
- name: Ensure Appservice Discord image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_appservice_discord_docker_image }}"
|
||||
@ -63,7 +89,7 @@
|
||||
{{ matrix_host_command_docker }} run --rm --name matrix-appservice-discord-link-gen
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
|
||||
--cap-drop=ALL
|
||||
-v {{ matrix_appservice_discord_config_path }}:/cfg
|
||||
--mount type=bind,src={{ matrix_appservice_discord_config_path }},dst=/cfg
|
||||
-w /cfg
|
||||
{{ matrix_appservice_discord_docker_image }}
|
||||
/bin/sh -c "node /build/tools/addbot.js > /cfg/invite_link"
|
||||
@ -80,3 +106,9 @@
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_appservice_discord_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-appservice-discord.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-appservice-discord.service"
|
||||
state: restarted
|
||||
when: "matrix_appservice_discord_requires_restart|bool"
|
||||
|
@ -10,6 +10,7 @@
|
||||
- "matrix_appservice_discord_bot_token"
|
||||
- "matrix_appservice_discord_appservice_token"
|
||||
- "matrix_appservice_discord_homeserver_token"
|
||||
- "matrix_appservice_discord_homeserver_domain"
|
||||
|
||||
- name: (Deprecation) Catch and report renamed appservice-discord variables
|
||||
fail:
|
||||
@ -19,3 +20,7 @@
|
||||
when: "item.old in vars"
|
||||
with_items:
|
||||
- {'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'"
|
||||
when: "matrix_appservice_discord_database_engine not in ['sqlite', 'postgres']"
|
||||
|
@ -26,10 +26,17 @@ bridge:
|
||||
disableReadReceipts: false
|
||||
# Disable Join Leave echos from matrix
|
||||
disableJoinLeaveNotifications: false
|
||||
# Disable Invite echos from matrix
|
||||
disableInviteNotifications: false
|
||||
# Auto-determine the language of code blocks (this can be CPU-intensive)
|
||||
determineCodeLanguage: false
|
||||
# Authentication configuration for the discord bot.
|
||||
auth:
|
||||
clientID: {{ matrix_appservice_discord_client_id|string|to_json }}
|
||||
botToken: {{ matrix_appservice_discord_bot_token }}
|
||||
# You must enable "Privileged Gateway Intents" in your bot settings on discord.com (e.g. https://discord.com/developers/applications/12345/bot)
|
||||
# for this to work
|
||||
usePrivilegedIntents: {{ matrix_appservice_discord_auth_usePrivilegedIntents|to_json }}
|
||||
logging:
|
||||
# What level should the logger output to the console at.
|
||||
console: "warn" #silly, verbose, info, http, warn, error, silent
|
||||
@ -45,16 +52,17 @@ logging:
|
||||
# enable:
|
||||
# - "DiscordBot"
|
||||
database:
|
||||
userStorePath: "/data/user-store.db"
|
||||
roomStorePath: "/data/room-store.db"
|
||||
# You may either use SQLite or Postgresql for the bridge database, which contains
|
||||
# important mappings for events and user puppeting configurations.
|
||||
# Use the filename option for SQLite, or connString for Postgresql.
|
||||
# If you are migrating, see https://github.com/Half-Shot/matrix-appservice-discord/blob/master/docs/howto.md#migrate-to-postgres-from-sqlite
|
||||
# WARNING: You will almost certainly be fine with sqlite unless your bridge
|
||||
# is in heavy demand and you suffer from IO slowness.
|
||||
filename: "/data/discord.db"
|
||||
# connString: "postgresql://user:password@localhost/database_name"
|
||||
{% if matrix_appservice_discord_database_engine == 'sqlite' %}
|
||||
filename: {{ matrix_appservice_discord_database_filename|to_json }}
|
||||
{% else %}
|
||||
connString: {{ matrix_appservice_discord_database_connString|to_json }}
|
||||
{% endif %}
|
||||
room:
|
||||
# Set the default visibility of alias rooms, defaults to "public".
|
||||
# One of: "public", "private"
|
||||
@ -82,10 +90,12 @@ channel:
|
||||
limits:
|
||||
# Delay in milliseconds between discord users joining a room.
|
||||
roomGhostJoinDelay: 6000
|
||||
# Delay in milliseconds before sending messages to discord to avoid echos.
|
||||
# (Copies of a sent message may arrive from discord before we've
|
||||
# Lock timeout in milliseconds before sending messages to discord to avoid
|
||||
# echos. Default is rather high as the lock will most likely time out
|
||||
# before anyways.
|
||||
# echos = (Copies of a sent message may arrive from discord before we've
|
||||
# fininished handling it, causing us to echo it back to the room)
|
||||
discordSendDelay: 750
|
||||
discordSendDelay: 1500
|
||||
ghosts:
|
||||
# Pattern for the ghosts nick, available is :nick, :username, :tag and :id
|
||||
nickPattern: ":nick"
|
||||
|
@ -8,6 +8,7 @@ After={{ service }}
|
||||
{% for service in matrix_appservice_discord_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
@ -25,8 +26,8 @@ ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-appservice-dis
|
||||
{% if matrix_appservice_discord_container_http_host_bind_port %}
|
||||
-p {{ matrix_appservice_discord_container_http_host_bind_port }}:9005 \
|
||||
{% endif %}
|
||||
-v {{ matrix_appservice_discord_config_path }}:/cfg \
|
||||
-v {{ matrix_appservice_discord_data_path }}:/data \
|
||||
--mount type=bind,src={{ matrix_appservice_discord_config_path }},dst=/cfg \
|
||||
--mount type=bind,src={{ matrix_appservice_discord_data_path }},dst=/data \
|
||||
{% for arg in matrix_appservice_discord_container_extra_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
matrix_appservice_irc_enabled: true
|
||||
|
||||
matrix_appservice_irc_docker_image: "matrixdotorg/matrix-appservice-irc:release-0.17.1"
|
||||
matrix_appservice_irc_docker_image: "docker.io/matrixdotorg/matrix-appservice-irc:release-0.17.1"
|
||||
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"
|
||||
@ -16,6 +16,25 @@ matrix_appservice_irc_homeserver_domain: '{{ matrix_domain }}'
|
||||
matrix_appservice_irc_homeserver_enablePresence: true
|
||||
matrix_appservice_irc_appservice_address: 'http://matrix-appservice-irc:9999'
|
||||
|
||||
matrix_appservice_irc_database_engine: nedb
|
||||
matrix_appservice_irc_database_username: matrix_appservice_irc
|
||||
matrix_appservice_irc_database_password: ~
|
||||
matrix_appservice_irc_database_hostname: 'matrix-postgres'
|
||||
matrix_appservice_irc_database_port: 5432
|
||||
matrix_appservice_irc_database_name: matrix_appservice_irc
|
||||
|
||||
# This is just the Postgres connection string, if Postgres is used.
|
||||
# Naming clashes with `matrix_appservice_irc_database_connectionString` somewhat.
|
||||
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: "{{
|
||||
{
|
||||
'nedb': 'nedb:///data',
|
||||
'postgres': matrix_appservice_irc_database_connection_string,
|
||||
}[matrix_appservice_irc_database_engine]
|
||||
}}"
|
||||
|
||||
matrix_appservice_irc_ircService_servers: []
|
||||
|
||||
# Example of `matrix_appservice_irc_ircService_servers` with one server (and all its options):
|
||||
|
@ -0,0 +1,64 @@
|
||||
- name: Fail if Postgres not enabled
|
||||
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:
|
||||
postgres_start_wait_time: 15
|
||||
when: "postgres_start_wait_time|default('') == ''"
|
||||
|
||||
# Actual import work
|
||||
|
||||
- name: Ensure matrix-postgres is started
|
||||
service:
|
||||
name: matrix-postgres
|
||||
state: started
|
||||
daemon_reload: yes
|
||||
register: matrix_postgres_service_start_result
|
||||
|
||||
- name: Wait a bit, so that Postgres can start
|
||||
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-irc is stopped
|
||||
service:
|
||||
name: matrix-appservice-irc
|
||||
state: stopped
|
||||
|
||||
- name: Import appservice-irc NeDB database into Postgres
|
||||
command:
|
||||
cmd: >-
|
||||
{{ matrix_host_command_docker }} run
|
||||
--rm
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
|
||||
--cap-drop=ALL
|
||||
--network={{ matrix_docker_network }}
|
||||
--mount type=bind,src={{ matrix_appservice_irc_data_path }},dst=/data
|
||||
--entrypoint=/bin/sh
|
||||
{{ 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 }}'
|
||||
|
||||
- name: Archive NeDB database files
|
||||
command:
|
||||
cmd: "mv {{ matrix_appservice_irc_data_path }}/{{ item }} {{ matrix_appservice_irc_data_path }}/{{ item }}.backup"
|
||||
with_items:
|
||||
- rooms.db
|
||||
- users.db
|
||||
|
||||
- name: Inject result
|
||||
set_fact:
|
||||
matrix_playbook_runtime_results: |
|
||||
{{
|
||||
matrix_playbook_runtime_results|default([])
|
||||
+
|
||||
[
|
||||
"NOTE: Your appservice-irc database files have been imported into Postgres. The original database files have been moved from `{{ matrix_appservice_irc_data_path }}/*.db` to `{{ matrix_appservice_irc_data_path }}/*.db.backup`. When you've confirmed that the import went well and everything works, you should be able to safely delete these files."
|
||||
]
|
||||
}}
|
@ -1,12 +1,5 @@
|
||||
---
|
||||
|
||||
- name: Ensure Appservice IRC image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_appservice_irc_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_appservice_irc_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_appservice_irc_docker_image_force_pull }}"
|
||||
|
||||
- name: Ensure Appservice IRC paths exist
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
@ -24,25 +17,48 @@
|
||||
path: "{{ matrix_appservice_irc_base_path }}/passkey.pem"
|
||||
register: matrix_appservice_irc_stat_passkey
|
||||
|
||||
- name: (Data relocation) Ensure matrix-appservice-irc.service is stopped
|
||||
service:
|
||||
name: matrix-appservice-irc
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
failed_when: false
|
||||
- block:
|
||||
- name: (Data relocation) Ensure matrix-appservice-irc.service is stopped
|
||||
service:
|
||||
name: matrix-appservice-irc
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
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"
|
||||
|
||||
- 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 }}"
|
||||
with_items:
|
||||
- rooms.db
|
||||
- users.db
|
||||
failed_when: false
|
||||
when: "matrix_appservice_irc_stat_passkey.stat.exists"
|
||||
|
||||
- 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"
|
||||
when: "matrix_appservice_irc_stat_passkey.stat.exists"
|
||||
- set_fact:
|
||||
matrix_appservice_irc_requires_restart: false
|
||||
|
||||
- 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 }}"
|
||||
with_items:
|
||||
- rooms.db
|
||||
- users.db
|
||||
failed_when: false
|
||||
when: "matrix_appservice_irc_stat_passkey.stat.exists"
|
||||
- block:
|
||||
- name: Check if a nedb database already exists
|
||||
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"
|
||||
|
||||
- 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'"
|
||||
|
||||
- name: Ensure Appservice IRC image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_appservice_irc_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_appservice_irc_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_appservice_irc_docker_image_force_pull }}"
|
||||
|
||||
- name: Ensure Matrix Appservice IRC config installed
|
||||
copy:
|
||||
@ -147,3 +163,9 @@
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_appservice_irc_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-appservice-irc.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-appservice-irc.service"
|
||||
state: restarted
|
||||
when: "matrix_appservice_irc_requires_restart|bool"
|
||||
|
@ -127,8 +127,8 @@ advanced:
|
||||
# Use an external database to store bridge state.
|
||||
database:
|
||||
# database engine (must be 'postgres' or 'nedb'). Default: nedb
|
||||
engine: "nedb"
|
||||
engine: {{ matrix_appservice_irc_database_engine|to_json }}
|
||||
# Either a PostgreSQL connection string, or a path to the NeDB storage directory.
|
||||
# For postgres, it must start with postgres://
|
||||
# For NeDB, it must start with nedb://. The path is relative to the project directory.
|
||||
connectionString: "nedb:///data"
|
||||
connectionString: {{ matrix_appservice_irc_database_connectionString|to_json }}
|
||||
|
@ -8,6 +8,7 @@ After={{ service }}
|
||||
{% for service in matrix_appservice_irc_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
matrix_appservice_slack_enabled: true
|
||||
|
||||
matrix_appservice_slack_docker_image: "matrixdotorg/matrix-appservice-slack:release-1.5.0"
|
||||
matrix_appservice_slack_docker_image: "docker.io/matrixdotorg/matrix-appservice-slack:release-1.5.0"
|
||||
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"
|
||||
@ -45,6 +45,26 @@ matrix_appservice_slack_appservice_token: ''
|
||||
matrix_appservice_slack_homeserver_token: ''
|
||||
matrix_appservice_slack_id_token: ''
|
||||
|
||||
matrix_appservice_slack_database_engine: nedb
|
||||
matrix_appservice_slack_database_username: matrix_appservice_slack
|
||||
matrix_appservice_slack_database_password: ~
|
||||
matrix_appservice_slack_database_hostname: 'matrix-postgres'
|
||||
matrix_appservice_slack_database_port: 5432
|
||||
matrix_appservice_slack_database_name: matrix_appservice_slack
|
||||
|
||||
# This is just the Postgres connection string, if Postgres is used.
|
||||
# Naming clashes with `matrix_appservice_slack_database_connectionString` somewhat.
|
||||
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: "{{
|
||||
{
|
||||
'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') }}"
|
||||
|
||||
matrix_appservice_slack_configuration_extension_yaml: |
|
||||
|
@ -0,0 +1,66 @@
|
||||
- name: Fail if Postgres not enabled
|
||||
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:
|
||||
postgres_start_wait_time: 15
|
||||
when: "postgres_start_wait_time|default('') == ''"
|
||||
|
||||
# Actual import work
|
||||
|
||||
- name: Ensure matrix-postgres is started
|
||||
service:
|
||||
name: matrix-postgres
|
||||
state: started
|
||||
daemon_reload: yes
|
||||
register: matrix_postgres_service_start_result
|
||||
|
||||
- name: Wait a bit, so that Postgres can start
|
||||
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:
|
||||
name: matrix-appservice-slack
|
||||
state: stopped
|
||||
|
||||
- name: Import appservice-slack NeDB database into Postgres
|
||||
command:
|
||||
cmd: >-
|
||||
{{ matrix_host_command_docker }} run
|
||||
--rm
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
|
||||
--cap-drop=ALL
|
||||
--network={{ matrix_docker_network }}
|
||||
--mount type=bind,src={{ matrix_appservice_slack_data_path }},dst=/data
|
||||
--entrypoint=/bin/sh
|
||||
{{ 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 }}'
|
||||
|
||||
- name: Archive NeDB database files
|
||||
command:
|
||||
cmd: "mv {{ matrix_appservice_slack_data_path }}/{{ item }} {{ matrix_appservice_slack_data_path }}/{{ item }}.backup"
|
||||
with_items:
|
||||
- teams.db
|
||||
- room-store.db
|
||||
- user-store.db
|
||||
- event-store.db
|
||||
|
||||
- name: Inject result
|
||||
set_fact:
|
||||
matrix_playbook_runtime_results: |
|
||||
{{
|
||||
matrix_playbook_runtime_results|default([])
|
||||
+
|
||||
[
|
||||
"NOTE: Your appservice-slack database files have been imported into Postgres. The original database files have been moved from `{{ matrix_appservice_slack_data_path }}/*.db` to `{{ matrix_appservice_slack_data_path }}/*.db.backup`. When you've confirmed that the import went well and everything works, you should be able to safely delete these files."
|
||||
]
|
||||
}}
|
@ -1,12 +1,5 @@
|
||||
---
|
||||
|
||||
- name: Ensure Appservice Slack image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_appservice_slack_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_appservice_slack_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_appservice_slack_docker_image_force_pull }}"
|
||||
|
||||
- name: Ensure AppService Slack paths exist
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
@ -19,6 +12,30 @@
|
||||
- "{{ matrix_appservice_slack_config_path }}"
|
||||
- "{{ matrix_appservice_slack_data_path }}"
|
||||
|
||||
- set_fact:
|
||||
matrix_appservice_slack_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if a nedb database already exists
|
||||
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"
|
||||
|
||||
- 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'"
|
||||
|
||||
- name: Ensure Appservice Slack image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_appservice_slack_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_appservice_slack_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_appservice_slack_docker_image_force_pull }}"
|
||||
|
||||
- name: Ensure Matrix Appservice Slack config installed
|
||||
copy:
|
||||
content: "{{ matrix_appservice_slack_configuration|to_nice_yaml }}"
|
||||
@ -46,3 +63,9 @@
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_appservice_slack_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-appservice-slack.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-appservice-slack.service"
|
||||
state: restarted
|
||||
when: "matrix_appservice_slack_requires_restart|bool"
|
||||
|
@ -9,4 +9,4 @@
|
||||
- "matrix_appservice_slack_control_room_id"
|
||||
- "matrix_appservice_slack_appservice_token"
|
||||
- "matrix_appservice_slack_homeserver_token"
|
||||
- "matrix_appservice_slack_id_token"
|
||||
- "matrix_appservice_slack_id_token"
|
||||
|
@ -9,6 +9,12 @@ homeserver:
|
||||
url: "{{ matrix_appservice_slack_homeserver_url }}"
|
||||
server_name: "{{ matrix_domain }}"
|
||||
|
||||
{% if matrix_appservice_slack_database_engine == 'nedb' %}
|
||||
dbdir: "/data"
|
||||
{% else %}
|
||||
db:
|
||||
engine: {{ matrix_appservice_slack_database_engine|to_json }}
|
||||
connectionString: {{ matrix_appservice_slack_database_connectionString|to_json }}
|
||||
{% endif %}
|
||||
|
||||
matrix_admin_room: "{{ matrix_appservice_slack_control_room_id }}"
|
||||
|
@ -8,6 +8,7 @@ After={{ service }}
|
||||
{% for service in matrix_appservice_slack_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
matrix_appservice_webhooks_enabled: true
|
||||
|
||||
matrix_appservice_webhooks_docker_image: "turt2live/matrix-appservice-webhooks:latest"
|
||||
matrix_appservice_webhooks_docker_image: "docker.io/turt2live/matrix-appservice-webhooks:latest"
|
||||
matrix_appservice_webhooks_docker_image_force_pull: "{{ matrix_appservice_webhooks_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_appservice_webhooks_base_path: "{{ matrix_base_data_path }}/appservice-webhooks"
|
||||
|
@ -8,6 +8,7 @@ After={{ service }}
|
||||
{% for service in matrix_appservice_webhooks_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
@ -4,9 +4,11 @@
|
||||
matrix_mautrix_facebook_enabled: true
|
||||
|
||||
matrix_mautrix_facebook_container_image_self_build: false
|
||||
matrix_mautrix_facebook_container_image_self_build_repo: "https://github.com/tulir/mautrix-facebook.git"
|
||||
|
||||
# See: https://mau.dev/tulir/mautrix-facebook/container_registry
|
||||
matrix_mautrix_facebook_docker_image: "dock.mau.dev/tulir/mautrix-facebook:latest"
|
||||
matrix_mautrix_facebook_docker_image: "{{ matrix_mautrix_facebook_docker_image_name_prefix }}tulir/mautrix-facebook:latest"
|
||||
matrix_mautrix_facebook_docker_image_name_prefix: "{{ 'localhost/' if matrix_mautrix_facebook_container_image_self_build else 'dock.mau.dev/' }}"
|
||||
matrix_mautrix_facebook_docker_image_force_pull: "{{ matrix_mautrix_facebook_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_mautrix_facebook_base_path: "{{ matrix_base_data_path }}/mautrix-facebook"
|
||||
@ -30,9 +32,42 @@ matrix_mautrix_facebook_systemd_wanted_services_list: []
|
||||
matrix_mautrix_facebook_appservice_token: ''
|
||||
matrix_mautrix_facebook_homeserver_token: ''
|
||||
|
||||
|
||||
# Database-related configuration fields.
|
||||
#
|
||||
# To use SQLite, stick to these defaults.
|
||||
#
|
||||
# To use Postgres:
|
||||
# - change the engine (`matrix_mautrix_facebook_database_engine: 'postgres'`)
|
||||
# - adjust your database credentials via the `matrix_mautrix_facebook_postgres_*` variables
|
||||
matrix_mautrix_facebook_database_engine: 'sqlite'
|
||||
|
||||
matrix_mautrix_facebook_sqlite_database_path_local: "{{ matrix_mautrix_facebook_data_path }}/mautrix-facebook.db"
|
||||
matrix_mautrix_facebook_sqlite_database_path_in_container: "/data/mautrix-facebook.db"
|
||||
|
||||
matrix_mautrix_facebook_database_username: 'matrix_mautrix_facebook'
|
||||
matrix_mautrix_facebook_database_password: 'some-password'
|
||||
matrix_mautrix_facebook_database_hostname: 'matrix-postgres'
|
||||
matrix_mautrix_facebook_database_port: 5432
|
||||
matrix_mautrix_facebook_database_name: 'matrix_mautrix_facebook'
|
||||
|
||||
matrix_mautrix_facebook_database_connection_string: 'postgres://{{ matrix_mautrix_facebook_database_username }}:{{ matrix_mautrix_facebook_database_password }}@{{ matrix_mautrix_facebook_database_hostname }}:{{ matrix_mautrix_facebook_database_port }}/{{ matrix_mautrix_facebook_database_name }}'
|
||||
|
||||
matrix_mautrix_facebook_appservice_database: "{{
|
||||
{
|
||||
'sqlite': ('sqlite:///' + matrix_mautrix_facebook_sqlite_database_path_in_container),
|
||||
'postgres': matrix_mautrix_facebook_database_connection_string,
|
||||
}[matrix_mautrix_facebook_database_engine]
|
||||
}}"
|
||||
|
||||
|
||||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mautrix_facebook_login_shared_secret: ''
|
||||
|
||||
matrix_mautrix_facebook_bridge_login_shared_secret_map: "{{ {matrix_mautrix_facebook_homeserver_domain: matrix_mautrix_facebook_login_shared_secret} if matrix_mautrix_facebook_login_shared_secret else {} }}"
|
||||
|
||||
matrix_mautrix_facebook_bridge_presence: true
|
||||
|
||||
# Default configuration template which covers the generic use case.
|
||||
# You can customize it by controlling the various variables inside it.
|
||||
#
|
||||
|
@ -8,6 +8,32 @@
|
||||
The matrix-bridge-mautrix-facebook role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- set_fact:
|
||||
matrix_mautrix_facebook_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mautrix_facebook_sqlite_database_path_local }}"
|
||||
register: matrix_mautrix_facebook_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mautrix_facebook_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mautrix_facebook_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mautrix_facebook_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mautrix-facebook.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mautrix_facebook_requires_restart: true
|
||||
when: "matrix_mautrix_facebook_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mautrix_facebook_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure Mautrix Facebook image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mautrix_facebook_docker_image }}"
|
||||
@ -32,7 +58,7 @@
|
||||
|
||||
- name: Ensure Mautrix Facebook repository is present on self-build
|
||||
git:
|
||||
repo: https://github.com/tulir/mautrix-facebook.git
|
||||
repo: "{{ matrix_mautrix_facebook_container_image_self_build_repo }}"
|
||||
dest: "{{ matrix_mautrix_facebook_docker_src_files_path }}"
|
||||
# version: "{{ matrix_coturn_docker_image.split(':')[1] }}"
|
||||
force: "yes"
|
||||
@ -43,12 +69,12 @@
|
||||
docker_image:
|
||||
name: "{{ matrix_mautrix_facebook_docker_image }}"
|
||||
source: build
|
||||
force_source: yes
|
||||
force_source: "{{ matrix_mautrix_facebook_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_mautrix_facebook_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_mautrix_facebook_enabled|bool and matrix_mautrix_facebook_container_image_self_build and matrix_mautrix_facebook_git_pull_results.changed"
|
||||
when: "matrix_mautrix_facebook_enabled|bool and matrix_mautrix_facebook_container_image_self_build|bool"
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
@ -94,3 +120,9 @@
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mautrix_facebook_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mautrix-facebook.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mautrix-facebook.service"
|
||||
state: restarted
|
||||
when: "matrix_mautrix_facebook_requires_restart|bool"
|
||||
|
@ -27,7 +27,7 @@ appservice:
|
||||
# Format examples:
|
||||
# SQLite: sqlite:///filename.db
|
||||
# Postgres: postgres://username:password@hostname/dbname
|
||||
database: sqlite:////data/mautrix-facebook.db
|
||||
database: {{ matrix_mautrix_facebook_appservice_database|to_json }}
|
||||
|
||||
# Public part of web server for out-of-Matrix interaction with the bridge.
|
||||
public:
|
||||
@ -81,23 +81,32 @@ bridge:
|
||||
command_prefix: "!fb"
|
||||
|
||||
# Number of chats to sync (and create portals for) on startup/login.
|
||||
# Maximum 20, set 0 to disable automatic syncing.
|
||||
# Set 0 to disable automatic syncing.
|
||||
initial_chat_sync: 10
|
||||
# Whether or not the Facebook users of logged in Matrix users should be
|
||||
# invited to private chats when the user sends a message from another client.
|
||||
invite_own_puppet_to_pm: false
|
||||
# Whether or not to use /sync to get presence, read receipts and typing notifications when using
|
||||
# your own Matrix account as the Matrix puppet for your Facebook account.
|
||||
# Whether or not to use /sync to get presence, read receipts and typing notifications
|
||||
# when double puppeting is enabled
|
||||
sync_with_custom_puppets: true
|
||||
# Shared secret for https://github.com/devture/matrix-synapse-shared-secret-auth
|
||||
# Whether or not to update the m.direct account data event when double puppeting is enabled.
|
||||
# Note that updating the m.direct event is not atomic (except with mautrix-asmux)
|
||||
# and is therefore prone to race conditions.
|
||||
sync_direct_chat_list: false
|
||||
# Servers to always allow double puppeting from
|
||||
double_puppet_server_map: {}
|
||||
# example.com: https://example.com
|
||||
# Allow using double puppeting from any server with a valid client .well-known file.
|
||||
double_puppet_allow_discovery: false
|
||||
# Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth
|
||||
#
|
||||
# If set, custom puppets will be enabled automatically for local users
|
||||
# instead of users having to find an access token and run `login-matrix`
|
||||
# manually.
|
||||
login_shared_secret: {{ matrix_mautrix_facebook_login_shared_secret|to_json }}
|
||||
# Whether or not to bridge presence in both directions. Facebook allows users not to broadcast
|
||||
# presence, but then it won't send other users' presence to the client.
|
||||
presence: true
|
||||
# If using this for other servers than the bridge's server,
|
||||
# you must also set the URL in the double_puppet_server_map.
|
||||
login_shared_secret_map: {{ matrix_mautrix_facebook_bridge_login_shared_secret_map|to_json }}
|
||||
presence: {{ matrix_mautrix_facebook_bridge_presence|to_json }}
|
||||
# Whether or not to update avatars when syncing all contacts at startup.
|
||||
update_avatar_initial_sync: true
|
||||
# End-to-bridge encryption support options. These require matrix-nio to be installed with pip
|
||||
|
@ -8,6 +8,7 @@ After={{ service }}
|
||||
{% for service in matrix_mautrix_facebook_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
@ -17,6 +18,7 @@ ExecStartPre={{ matrix_host_command_docker }} run --rm --name matrix-mautrix-fac
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--network={{ matrix_docker_network }} \
|
||||
-v {{ matrix_mautrix_facebook_config_path }}:/config:z \
|
||||
-v {{ matrix_mautrix_facebook_data_path }}:/data:z \
|
||||
{{ matrix_mautrix_facebook_docker_image }} \
|
||||
|
@ -4,9 +4,11 @@
|
||||
matrix_mautrix_hangouts_enabled: true
|
||||
|
||||
matrix_mautrix_hangouts_container_image_self_build: false
|
||||
matrix_mautrix_hangouts_container_image_self_build_repo: "https://github.com/tulir/mautrix-hangouts.git"
|
||||
|
||||
# See: https://mau.dev/tulir/mautrix-hangouts/container_registry
|
||||
matrix_mautrix_hangouts_docker_image: "dock.mau.dev/tulir/mautrix-hangouts:latest"
|
||||
matrix_mautrix_hangouts_docker_image: "{{ matrix_mautrix_hangouts_docker_image_name_prefix }}tulir/mautrix-hangouts:latest"
|
||||
matrix_mautrix_hangouts_docker_image_name_prefix: "{{ 'localhost/' if matrix_mautrix_hangouts_container_image_self_build else 'dock.mau.dev/' }}"
|
||||
matrix_mautrix_hangouts_docker_image_force_pull: "{{ matrix_mautrix_hangouts_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_mautrix_hangouts_base_path: "{{ matrix_base_data_path }}/mautrix-hangouts"
|
||||
@ -37,6 +39,35 @@ matrix_mautrix_hangouts_systemd_wanted_services_list: []
|
||||
matrix_mautrix_hangouts_appservice_token: ''
|
||||
matrix_mautrix_hangouts_homeserver_token: ''
|
||||
|
||||
|
||||
# Database-related configuration fields.
|
||||
#
|
||||
# To use SQLite, stick to these defaults.
|
||||
#
|
||||
# To use Postgres:
|
||||
# - change the engine (`matrix_mautrix_hangouts_database_engine: 'postgres'`)
|
||||
# - adjust your database credentials via the `matrix_mautrix_hangouts_postgres_*` variables
|
||||
matrix_mautrix_hangouts_database_engine: 'sqlite'
|
||||
|
||||
matrix_mautrix_hangouts_sqlite_database_path_local: "{{ matrix_mautrix_hangouts_data_path }}/mautrix-hangouts.db"
|
||||
matrix_mautrix_hangouts_sqlite_database_path_in_container: "/data/mautrix-hangouts.db"
|
||||
|
||||
matrix_mautrix_hangouts_database_username: 'matrix_mautrix_hangouts'
|
||||
matrix_mautrix_hangouts_database_password: 'some-password'
|
||||
matrix_mautrix_hangouts_database_hostname: 'matrix-postgres'
|
||||
matrix_mautrix_hangouts_database_port: 5432
|
||||
matrix_mautrix_hangouts_database_name: 'matrix_mautrix_hangouts'
|
||||
|
||||
matrix_mautrix_hangouts_database_connection_string: 'postgres://{{ matrix_mautrix_hangouts_database_username }}:{{ matrix_mautrix_hangouts_database_password }}@{{ matrix_mautrix_hangouts_database_hostname }}:{{ matrix_mautrix_hangouts_database_port }}/{{ matrix_mautrix_hangouts_database_name }}'
|
||||
|
||||
matrix_mautrix_hangouts_appservice_database: "{{
|
||||
{
|
||||
'sqlite': ('sqlite:///' + matrix_mautrix_hangouts_sqlite_database_path_in_container),
|
||||
'postgres': matrix_mautrix_hangouts_database_connection_string,
|
||||
}[matrix_mautrix_hangouts_database_engine]
|
||||
}}"
|
||||
|
||||
|
||||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mautrix_hangouts_login_shared_secret: ''
|
||||
|
||||
|
@ -8,6 +8,32 @@
|
||||
The matrix-bridge-mautrix-hangouts role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- set_fact:
|
||||
matrix_mautrix_hangouts_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mautrix_hangouts_sqlite_database_path_local }}"
|
||||
register: matrix_mautrix_hangouts_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mautrix_hangouts_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mautrix_hangouts_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mautrix_hangouts_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mautrix-hangouts.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mautrix_hangouts_requires_restart: true
|
||||
when: "matrix_mautrix_hangouts_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mautrix_hangouts_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure Mautrix Hangouts image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mautrix_hangouts_docker_image }}"
|
||||
@ -32,22 +58,22 @@
|
||||
|
||||
- name: Ensure Mautrix Hangots repository is present on self build
|
||||
git:
|
||||
repo: https://github.com/tulir/mautrix-hangouts.git
|
||||
repo: "{{ matrix_mautrix_hangouts_container_image_self_build_repo }}"
|
||||
dest: "{{ matrix_mautrix_hangouts_docker_src_files_path }}"
|
||||
force: "yes"
|
||||
register: matrix_mautrix_hangouts_git_pull_results
|
||||
when: "matrix_mautrix_hangouts_enabled|bool and matrix_mautrix_hangouts_container_image_self_build"
|
||||
when: "matrix_mautrix_hangouts_enabled|bool and matrix_mautrix_hangouts_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure Mautrix Hangouts Docker image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_mautrix_hangouts_docker_image }}"
|
||||
source: build
|
||||
force_source: yes
|
||||
force_source: "{{ matrix_mautrix_hangouts_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_mautrix_hangouts_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_mautrix_hangouts_enabled|bool and matrix_mautrix_hangouts_container_image_self_build and matrix_mautrix_hangouts_git_pull_results.changed"
|
||||
when: "matrix_mautrix_hangouts_enabled|bool and matrix_mautrix_hangouts_container_image_self_build|bool"
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
@ -93,3 +119,9 @@
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mautrix_hangouts_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mautrix-hangouts.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mautrix-hangouts.service"
|
||||
state: restarted
|
||||
when: "matrix_mautrix_hangouts_requires_restart|bool"
|
||||
|
@ -27,7 +27,7 @@ appservice:
|
||||
# Format examples:
|
||||
# SQLite: sqlite:///filename.db
|
||||
# Postgres: postgres://username:password@hostname/dbname
|
||||
database: sqlite:////data/mautrix-hangouts.db
|
||||
database: {{ matrix_mautrix_hangouts_appservice_database|to_json }}
|
||||
|
||||
# The unique ID of this appservice.
|
||||
id: hangouts
|
||||
|
@ -8,6 +8,7 @@ After={{ service }}
|
||||
{% for service in matrix_mautrix_hangouts_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
@ -17,6 +18,7 @@ ExecStartPre={{ matrix_host_command_docker }} run --rm --name matrix-mautrix-han
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--network={{ matrix_docker_network }} \
|
||||
-v {{ matrix_mautrix_hangouts_config_path }}:/config:z \
|
||||
-v {{ matrix_mautrix_hangouts_data_path }}:/data:z \
|
||||
{{ matrix_mautrix_hangouts_docker_image }} \
|
||||
|
@ -4,7 +4,7 @@
|
||||
matrix_mautrix_telegram_enabled: true
|
||||
|
||||
# See: https://mau.dev/tulir/mautrix-telegram/container_registry
|
||||
matrix_mautrix_telegram_docker_image: "dock.mau.dev/tulir/mautrix-telegram:v0.8.2"
|
||||
matrix_mautrix_telegram_docker_image: "dock.mau.dev/tulir/mautrix-telegram:v0.9.0"
|
||||
matrix_mautrix_telegram_docker_image_force_pull: "{{ matrix_mautrix_telegram_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_mautrix_telegram_base_path: "{{ matrix_base_data_path }}/mautrix-telegram"
|
||||
@ -43,6 +43,35 @@ matrix_mautrix_telegram_systemd_wanted_services_list: []
|
||||
matrix_mautrix_telegram_appservice_token: ''
|
||||
matrix_mautrix_telegram_homeserver_token: ''
|
||||
|
||||
|
||||
# Database-related configuration fields.
|
||||
#
|
||||
# To use SQLite, stick to these defaults.
|
||||
#
|
||||
# To use Postgres:
|
||||
# - change the engine (`matrix_mautrix_telegram_database_engine: 'postgres'`)
|
||||
# - adjust your database credentials via the `matrix_mautrix_telegram_postgres_*` variables
|
||||
matrix_mautrix_telegram_database_engine: 'sqlite'
|
||||
|
||||
matrix_mautrix_telegram_sqlite_database_path_local: "{{ matrix_mautrix_telegram_data_path }}/mautrix-telegram.db"
|
||||
matrix_mautrix_telegram_sqlite_database_path_in_container: "/data/mautrix-telegram.db"
|
||||
|
||||
matrix_mautrix_telegram_database_username: 'matrix_mautrix_telegram'
|
||||
matrix_mautrix_telegram_database_password: 'some-password'
|
||||
matrix_mautrix_telegram_database_hostname: 'matrix-postgres'
|
||||
matrix_mautrix_telegram_database_port: 5432
|
||||
matrix_mautrix_telegram_database_name: 'matrix_mautrix_telegram'
|
||||
|
||||
matrix_mautrix_telegram_database_connection_string: 'postgres://{{ matrix_mautrix_telegram_database_username }}:{{ matrix_mautrix_telegram_database_password }}@{{ matrix_mautrix_telegram_database_hostname }}:{{ matrix_mautrix_telegram_database_port }}/{{ matrix_mautrix_telegram_database_name }}'
|
||||
|
||||
matrix_mautrix_telegram_appservice_database: "{{
|
||||
{
|
||||
'sqlite': ('sqlite:///' + matrix_mautrix_telegram_sqlite_database_path_in_container),
|
||||
'postgres': matrix_mautrix_telegram_database_connection_string,
|
||||
}[matrix_mautrix_telegram_database_engine]
|
||||
}}"
|
||||
|
||||
|
||||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mautrix_telegram_login_shared_secret: ''
|
||||
|
||||
|
@ -8,6 +8,32 @@
|
||||
The matrix-bridge-mautrix-telegram role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- set_fact:
|
||||
matrix_mautrix_telegram_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mautrix_telegram_sqlite_database_path_local }}"
|
||||
register: matrix_mautrix_telegram_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mautrix_telegram_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mautrix_telegram_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mautrix_telegram_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mautrix-telegram.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mautrix_telegram_requires_restart: true
|
||||
when: "matrix_mautrix_telegram_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mautrix_telegram_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure Mautrix Telegram image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mautrix_telegram_docker_image }}"
|
||||
@ -71,3 +97,9 @@
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mautrix_telegram_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mautrix-telegram.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mautrix-telegram.service"
|
||||
state: restarted
|
||||
when: "matrix_mautrix_telegram_requires_restart|bool"
|
||||
|
@ -27,7 +27,7 @@ appservice:
|
||||
# Format examples:
|
||||
# SQLite: sqlite:///filename.db
|
||||
# Postgres: postgres://username:password@hostname/dbname
|
||||
database: sqlite:////data/mautrix-telegram.db
|
||||
database: {{ matrix_mautrix_telegram_appservice_database|to_json }}
|
||||
|
||||
# Public part of web server for out-of-Matrix interaction with the bridge.
|
||||
# Used for things like login if the user wants to make sure the 2FA password isn't stored in
|
||||
|
@ -8,6 +8,7 @@ After={{ service }}
|
||||
{% for service in matrix_mautrix_telegram_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
@ -27,6 +27,42 @@ matrix_mautrix_whatsapp_systemd_wanted_services_list: []
|
||||
matrix_mautrix_whatsapp_appservice_token: ''
|
||||
matrix_mautrix_whatsapp_homeserver_token: ''
|
||||
|
||||
|
||||
# Database-related configuration fields.
|
||||
#
|
||||
# To use SQLite, stick to these defaults.
|
||||
#
|
||||
# To use Postgres:
|
||||
# - change the engine (`matrix_mautrix_whatsapp_database_engine: 'postgres'`)
|
||||
# - adjust your database credentials via the `matrix_mautrix_whatsapp_postgres_*` variables
|
||||
matrix_mautrix_whatsapp_database_engine: 'sqlite'
|
||||
|
||||
matrix_mautrix_whatsapp_sqlite_database_path_local: "{{ matrix_mautrix_whatsapp_data_path }}/mautrix-whatsapp.db"
|
||||
matrix_mautrix_whatsapp_sqlite_database_path_in_container: "/data/mautrix-whatsapp.db"
|
||||
|
||||
matrix_mautrix_whatsapp_database_username: 'matrix_mautrix_whatsapp'
|
||||
matrix_mautrix_whatsapp_database_password: 'some-password'
|
||||
matrix_mautrix_whatsapp_database_hostname: 'matrix-postgres'
|
||||
matrix_mautrix_whatsapp_database_port: 5432
|
||||
matrix_mautrix_whatsapp_database_name: 'matrix_mautrix_whatsapp'
|
||||
|
||||
matrix_mautrix_whatsapp_database_connection_string: 'postgresql://{{ matrix_mautrix_whatsapp_database_username }}:{{ matrix_mautrix_whatsapp_database_password }}@{{ matrix_mautrix_whatsapp_database_hostname }}:{{ matrix_mautrix_whatsapp_database_port }}/{{ matrix_mautrix_whatsapp_database_name }}?sslmode=disable'
|
||||
|
||||
matrix_mautrix_whatsapp_appservice_database_type: "{{
|
||||
{
|
||||
'sqlite': 'sqlite3',
|
||||
'postgres':'postgres',
|
||||
}[matrix_mautrix_whatsapp_database_engine]
|
||||
}}"
|
||||
|
||||
matrix_mautrix_whatsapp_appservice_database_uri: "{{
|
||||
{
|
||||
'sqlite': matrix_mautrix_whatsapp_sqlite_database_path_in_container,
|
||||
'postgres': matrix_mautrix_whatsapp_database_connection_string,
|
||||
}[matrix_mautrix_whatsapp_database_engine]
|
||||
}}"
|
||||
|
||||
|
||||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mautrix_whatsapp_login_shared_secret: ''
|
||||
|
||||
|
@ -8,6 +8,32 @@
|
||||
The matrix-bridge-mautrix-whatsapp role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- set_fact:
|
||||
matrix_mautrix_whatsapp_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mautrix_whatsapp_sqlite_database_path_local }}"
|
||||
register: matrix_mautrix_whatsapp_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mautrix_whatsapp_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mautrix_whatsapp_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mautrix_whatsapp_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mautrix-whatsapp.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mautrix_whatsapp_requires_restart: true
|
||||
when: "matrix_mautrix_whatsapp_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mautrix_whatsapp_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure Mautrix Whatsapp image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mautrix_whatsapp_docker_image }}"
|
||||
@ -26,12 +52,12 @@
|
||||
- "{{ matrix_mautrix_whatsapp_base_path }}"
|
||||
- "{{ matrix_mautrix_whatsapp_config_path }}"
|
||||
- "{{ matrix_mautrix_whatsapp_data_path }}"
|
||||
|
||||
|
||||
- name: Check if an old database file exists
|
||||
stat:
|
||||
path: "{{ matrix_mautrix_whatsapp_base_path }}/mautrix-whatsapp.db"
|
||||
register: matrix_mautrix_whatsapp_stat_database
|
||||
|
||||
|
||||
- name: Check if an old matrix state file exists
|
||||
stat:
|
||||
path: "{{ matrix_mautrix_whatsapp_base_path }}/mx-state.json"
|
||||
@ -48,7 +74,7 @@
|
||||
- name: (Data relocation) Move mautrix-whatsapp database file to ./data directory
|
||||
command: "mv {{ matrix_mautrix_whatsapp_base_path }}/mautrix-whatsapp.db {{ matrix_mautrix_whatsapp_data_path }}/mautrix-whatsapp.db"
|
||||
when: "matrix_mautrix_whatsapp_stat_database.stat.exists"
|
||||
|
||||
|
||||
- name: (Data relocation) Move mautrix-whatsapp mx-state file to ./data directory
|
||||
command: "mv {{ matrix_mautrix_whatsapp_base_path }}/mx-state.json {{ matrix_mautrix_whatsapp_data_path }}/mx-state.json"
|
||||
when: "matrix_mautrix_whatsapp_stat_mx_state.stat.exists"
|
||||
@ -80,3 +106,9 @@
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mautrix_whatsapp_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mautrix-whatsapp.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mautrix-whatsapp.service"
|
||||
state: restarted
|
||||
when: "matrix_mautrix_whatsapp_requires_restart|bool"
|
||||
|
@ -19,11 +19,11 @@ appservice:
|
||||
# Database config.
|
||||
database:
|
||||
# The database type. "sqlite3" and "postgres" are supported.
|
||||
type: sqlite3
|
||||
type: {{ matrix_mautrix_whatsapp_appservice_database_type|to_json }}
|
||||
# The database URI.
|
||||
# SQLite: File name is enough. https://github.com/mattn/go-sqlite3#connection-string
|
||||
# Postgres: Connection string. For example, postgres://user:password@host/database
|
||||
uri: mautrix-whatsapp.db
|
||||
uri: {{ matrix_mautrix_whatsapp_appservice_database_uri|to_json }}
|
||||
# Maximum number of connections. Mostly relevant for Postgres.
|
||||
max_open_conns: 20
|
||||
max_idle_conns: 2
|
||||
|
@ -8,6 +8,7 @@ After={{ service }}
|
||||
{% for service in matrix_mautrix_whatsapp_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
@ -4,13 +4,15 @@
|
||||
matrix_mx_puppet_discord_enabled: true
|
||||
|
||||
matrix_mx_puppet_discord_container_image_self_build: false
|
||||
matrix_mx_puppet_discord_container_image_self_build_repo: "https://github.com/matrix-discord/mx-puppet-discord.git"
|
||||
|
||||
# Controls whether the mx-puppet-discord container exposes its HTTP port (tcp/8432 in the container).
|
||||
#
|
||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:8432"), or empty string to not expose.
|
||||
matrix_mx_puppet_discord_container_http_host_bind_port: ''
|
||||
|
||||
matrix_mx_puppet_discord_docker_image: "sorunome/mx-puppet-discord:latest"
|
||||
matrix_mx_puppet_discord_docker_image: "{{ matrix_mx_puppet_discord_docker_image_name_prefix }}sorunome/mx-puppet-discord:latest"
|
||||
matrix_mx_puppet_discord_docker_image_name_prefix: "{{ 'localhost/' if matrix_mx_puppet_discord_container_image_self_build else 'docker.io/' }}"
|
||||
matrix_mx_puppet_discord_docker_image_force_pull: "{{ matrix_mx_puppet_discord_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_mx_puppet_discord_base_path: "{{ matrix_base_data_path }}/mx-puppet-discord"
|
||||
@ -53,6 +55,20 @@ matrix_mx_puppet_discord_homeserver_token: ''
|
||||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mx_puppet_discord_login_shared_secret: ''
|
||||
|
||||
# Database configuration
|
||||
matrix_mx_puppet_discord_database_engine: 'sqlite'
|
||||
|
||||
matrix_mx_puppet_discord_sqlite_database_path_local: "{{ matrix_mx_puppet_discord_data_path }}/database.db"
|
||||
matrix_mx_puppet_discord_sqlite_database_path_in_container: "/data/database.db"
|
||||
|
||||
matrix_mx_puppet_discord_database_username: matrix_mx_puppet_discord
|
||||
matrix_mx_puppet_discord_database_password: ~
|
||||
matrix_mx_puppet_discord_database_hostname: 'matrix-postgres'
|
||||
matrix_mx_puppet_discord_database_port: 5432
|
||||
matrix_mx_puppet_discord_database_name: matrix_mx_puppet_discord
|
||||
|
||||
matrix_mx_puppet_discord_database_connection_string: 'postgresql://{{ matrix_mx_puppet_discord_database_username }}:{{ matrix_mx_puppet_discord_database_password }}@{{ matrix_mx_puppet_discord_database_hostname }}:{{ matrix_mx_puppet_discord_database_port }}/{{ matrix_mx_puppet_discord_database_name }}?sslmode=disable'
|
||||
|
||||
# Default configuration template which covers the generic use case.
|
||||
# You can customize it by controlling the various variables inside it.
|
||||
#
|
||||
|
@ -8,14 +8,6 @@
|
||||
The matrix-bridge-mx-puppet-discord role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- name: Ensure MX Puppet Discord image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_discord_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_discord_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mx_puppet_discord_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_discord_enabled|bool and not matrix_mx_puppet_discord_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Discord paths exist
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
@ -30,39 +22,75 @@
|
||||
- { path: "{{ matrix_mx_puppet_discord_docker_src_files_path }}", when: "{{ matrix_mx_puppet_discord_container_image_self_build }}" }
|
||||
when: matrix_mx_puppet_discord_enabled|bool and item.when|bool
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_discord_base_path }}/database.db"
|
||||
register: matrix_mx_puppet_discord_stat_database
|
||||
|
||||
- block:
|
||||
- name: (Data relocation) Ensure matrix-mx-puppet-discord.service is stopped
|
||||
service:
|
||||
name: matrix-mx-puppet-discord
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
failed_when: False
|
||||
|
||||
- name: (Data relocation) Move mx-puppet-discord database file to ./data directory
|
||||
command: "mv {{ matrix_mx_puppet_discord_base_path }}/database.db {{ matrix_mx_puppet_discord_data_path }}/database.db"
|
||||
when: "matrix_mx_puppet_discord_stat_database.stat.exists"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_discord_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_discord_sqlite_database_path_local }}"
|
||||
register: matrix_mx_puppet_discord_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mx_puppet_discord_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mx_puppet_discord_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mx_puppet_discord_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mx-puppet-discord.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_discord_requires_restart: true
|
||||
when: "matrix_mx_puppet_discord_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mx_puppet_discord_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure MX Puppet Discord image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_discord_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_discord_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mx_puppet_discord_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_discord_enabled|bool and not matrix_mx_puppet_discord_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Discord repository is present on self build
|
||||
git:
|
||||
repo: https://github.com/matrix-discord/mx-puppet-discord.git
|
||||
repo: "{{ matrix_mx_puppet_discord_container_image_self_build_repo }}"
|
||||
dest: "{{ matrix_mx_puppet_discord_docker_src_files_path }}"
|
||||
force: "yes"
|
||||
register: matrix_mx_puppet_discord_git_pull_results
|
||||
when: "matrix_mx_puppet_discord_enabled|bool and matrix_mx_puppet_discord_container_image_self_build"
|
||||
|
||||
- name: Ensure MX Puppet Discord Docker image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_discord_docker_image }}"
|
||||
source: build
|
||||
force_source: "{{ matrix_mx_puppet_discord_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_mx_puppet_discord_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_mx_puppet_discord_enabled|bool and matrix_mx_puppet_discord_container_image_self_build"
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_discord_base_path }}/database.db"
|
||||
register: matrix_mx_puppet_discord_stat_database
|
||||
|
||||
- name: (Data relocation) Ensure matrix-mx-puppet-discord.service is stopped
|
||||
service:
|
||||
name: matrix-mx-puppet-discord
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
failed_when: false
|
||||
when: "matrix_mx_puppet_discord_stat_database.stat.exists"
|
||||
|
||||
- name: (Data relocation) Move mx-puppet-discord database file to ./data directory
|
||||
command: "mv {{ matrix_mx_puppet_discord_base_path }}/database.db {{ matrix_mx_puppet_discord_data_path }}/database.db"
|
||||
when: "matrix_mx_puppet_discord_stat_database.stat.exists"
|
||||
when: "matrix_mx_puppet_discord_enabled|bool and matrix_mx_puppet_discord_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure mx-puppet-discord config.yaml installed
|
||||
copy:
|
||||
@ -91,3 +119,9 @@
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mx_puppet_discord_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mx-puppet-discord.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mx-puppet-discord.service"
|
||||
state: restarted
|
||||
when: "matrix_mx_puppet_discord_requires_restart|bool"
|
||||
|
@ -100,15 +100,18 @@ namePatterns:
|
||||
group: :name
|
||||
|
||||
database:
|
||||
{% if matrix_mx_puppet_discord_database_engine == 'sqlite' %}
|
||||
# Use SQLite3 as a database backend
|
||||
# The name of the database file
|
||||
filename: {{ matrix_mx_puppet_discord_sqlite_database_path_in_container|to_json }}
|
||||
{% else %}
|
||||
# Use Postgres as a database backend
|
||||
# If set, will be used instead of SQLite3
|
||||
# Connection string to connect to the Postgres instance
|
||||
# with username "user", password "pass", host "localhost" and database name "dbname".
|
||||
# Modify each value as necessary
|
||||
#connString: "postgres://user:pass@localhost/dbname?sslmode=disable"
|
||||
# Use SQLite3 as a database backend
|
||||
# The name of the database file
|
||||
filename: /data/database.db
|
||||
connString: {{ matrix_mx_puppet_discord_database_connection_string|to_json }}
|
||||
{% endif %}
|
||||
|
||||
logging:
|
||||
# Log level of console output
|
||||
|
@ -8,6 +8,7 @@ After={{ service }}
|
||||
{% for service in matrix_mx_puppet_discord_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
@ -4,8 +4,10 @@
|
||||
matrix_mx_puppet_instagram_enabled: true
|
||||
|
||||
matrix_mx_puppet_instagram_container_image_self_build: false
|
||||
matrix_mx_puppet_instagram_container_image_self_build_repo: "https://github.com/Sorunome/mx-puppet-instagram.git"
|
||||
|
||||
matrix_mx_puppet_instagram_docker_image: "docker.io/sorunome/mx-puppet-instagram:latest"
|
||||
matrix_mx_puppet_instagram_docker_image: "{{ matrix_mx_puppet_instagram_docker_image_name_prefix }}sorunome/mx-puppet-instagram:latest"
|
||||
matrix_mx_puppet_instagram_docker_image_name_prefix: "{{ 'localhost/' if matrix_mx_puppet_instagram_container_image_self_build else 'docker.io/' }}"
|
||||
matrix_mx_puppet_instagram_docker_image_force_pull: "{{ matrix_mx_puppet_instagram_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_mx_puppet_instagram_base_path: "{{ matrix_base_data_path }}/mx-puppet-instagram"
|
||||
@ -44,6 +46,19 @@ matrix_mx_puppet_instagram_homeserver_token: ''
|
||||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mx_puppet_instagram_login_shared_secret: ''
|
||||
|
||||
matrix_mx_puppet_instagram_database_engine: sqlite
|
||||
|
||||
matrix_mx_puppet_instagram_sqlite_database_path_local: "{{ matrix_mx_puppet_instagram_data_path }}/database.db"
|
||||
matrix_mx_puppet_instagram_sqlite_database_path_in_container: "/data/database.db"
|
||||
|
||||
matrix_mx_puppet_instagram_database_username: matrix_mx_puppet_instagram
|
||||
matrix_mx_puppet_instagram_database_password: ~
|
||||
matrix_mx_puppet_instagram_database_hostname: 'matrix-postgres'
|
||||
matrix_mx_puppet_instagram_database_port: 5432
|
||||
matrix_mx_puppet_instagram_database_name: matrix_mx_puppet_instagram
|
||||
|
||||
matrix_mx_puppet_instagram_database_connection_string: 'postgresql://{{ matrix_mx_puppet_instagram_database_username }}:{{ matrix_mx_puppet_instagram_database_password }}@{{ matrix_mx_puppet_instagram_database_hostname }}:{{ matrix_mx_puppet_instagram_database_port }}/{{ matrix_mx_puppet_instagram_database_name }}?sslmode=disable'
|
||||
|
||||
# Default configuration template which covers the generic use case.
|
||||
# You can customize it by controlling the various variables inside it.
|
||||
#
|
||||
|
@ -8,6 +8,33 @@
|
||||
The matrix-bridge-mx-puppet-instagram role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_instagram_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_instagram_sqlite_database_path_local }}"
|
||||
register: matrix_mx_puppet_instagram_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mx_puppet_instagram_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mx_puppet_instagram_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mx_puppet_instagram_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mx-puppet-instagram.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_instagram_requires_restart: true
|
||||
when: "matrix_mx_puppet_instagram_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mx_puppet_instagram_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure mx-puppet-instagram image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_instagram_docker_image }}"
|
||||
@ -32,20 +59,22 @@
|
||||
|
||||
- name: Ensure mx-puppet-instagram repository is present on self build
|
||||
git:
|
||||
repo: https://github.com/Sorunome/mx-puppet-instagram.git
|
||||
repo: "{{ matrix_mx_puppet_instagram_container_image_self_build_repo }}"
|
||||
dest: "{{ matrix_mx_puppet_instagram_docker_src_files_path }}"
|
||||
force: "yes"
|
||||
when: "matrix_mx_puppet_instagram_enabled|bool and matrix_mx_puppet_instagram_container_image_self_build"
|
||||
register: matrix_mx_puppet_instagram_git_pull_results
|
||||
when: "matrix_mx_puppet_instagram_enabled|bool and matrix_mx_puppet_instagram_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure mx-puppet-instagram Docker image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_instagram_docker_image }}"
|
||||
source: build
|
||||
force_source: "{{ matrix_mx_puppet_instagram_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_mx_puppet_instagram_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_mx_puppet_instagram_enabled|bool and matrix_mx_puppet_instagram_container_image_self_build"
|
||||
when: "matrix_mx_puppet_instagram_enabled|bool and matrix_mx_puppet_instagram_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure mx-puppet-instagram config.yaml installed
|
||||
copy:
|
||||
@ -75,4 +104,8 @@
|
||||
daemon_reload: yes
|
||||
when: "matrix_mx_puppet_instagram_systemd_service_result.changed"
|
||||
|
||||
|
||||
- name: Ensure matrix-mx-puppet-instagram.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mx-puppet-instagram.service"
|
||||
state: restarted
|
||||
when: "matrix_mx_puppet_instagram_requires_restart|bool"
|
||||
|
@ -44,15 +44,18 @@ provisioning:
|
||||
apiPrefix: /_matrix/provision
|
||||
|
||||
database:
|
||||
{% if matrix_mx_puppet_instagram_database_engine == 'postgres' %}
|
||||
# Use Postgres as a database backend
|
||||
# If set, will be used instead of SQLite3
|
||||
# Connection string to connect to the Postgres instance
|
||||
# with username "user", password "pass", host "localhost" and database name "dbname".
|
||||
# Modify each value as necessary
|
||||
#connString: "postgres://user:pass@localhost/dbname?sslmode=disable"
|
||||
connString: {{ matrix_mx_puppet_instagram_database_connection_string|to_json }}
|
||||
{% else %}
|
||||
# Use SQLite3 as a database backend
|
||||
# The name of the database file
|
||||
filename: /data/database.db
|
||||
filename: {{ matrix_mx_puppet_instagram_sqlite_database_path_in_container|to_json }}
|
||||
{% endif %}
|
||||
|
||||
logging:
|
||||
# Log level of console output
|
||||
|
@ -8,6 +8,7 @@ After={{ service }}
|
||||
{% for service in matrix_mx_puppet_instagram_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
@ -4,8 +4,10 @@
|
||||
matrix_mx_puppet_skype_enabled: true
|
||||
|
||||
matrix_mx_puppet_skype_container_image_self_build: false
|
||||
matrix_mx_puppet_skype_container_image_self_build_repo: "https://github.com/Sorunome/mx-puppet-skype.git"
|
||||
|
||||
matrix_mx_puppet_skype_docker_image: "sorunome/mx-puppet-skype:latest"
|
||||
matrix_mx_puppet_skype_docker_image: "{{ matrix_mx_puppet_skype_docker_image_name_prefix }}sorunome/mx-puppet-skype:latest"
|
||||
matrix_mx_puppet_skype_docker_image_name_prefix: "{{ 'localhost/' if matrix_mx_puppet_skype_container_image_self_build else 'docker.io/' }}"
|
||||
matrix_mx_puppet_skype_docker_image_force_pull: "{{ matrix_mx_puppet_skype_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_mx_puppet_skype_base_path: "{{ matrix_base_data_path }}/mx-puppet-skype"
|
||||
@ -51,6 +53,20 @@ matrix_mx_puppet_skype_homeserver_token: ''
|
||||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mx_puppet_skype_login_shared_secret: ''
|
||||
|
||||
# Database configuration, role default is `sqlite` but playbook default is `postgres`
|
||||
matrix_mx_puppet_skype_database_engine: sqlite
|
||||
|
||||
matrix_mx_puppet_skype_sqlite_database_path_local: "{{ matrix_mx_puppet_skype_data_path }}/database.db"
|
||||
matrix_mx_puppet_skype_sqlite_database_path_in_container: "/data/database.db"
|
||||
|
||||
matrix_mx_puppet_skype_database_username: matrix_mx_puppet_skype
|
||||
matrix_mx_puppet_skype_database_password: ~
|
||||
matrix_mx_puppet_skype_database_hostname: 'matrix-postgres'
|
||||
matrix_mx_puppet_skype_database_port: 5432
|
||||
matrix_mx_puppet_skype_database_name: matrix_mx_puppet_skype
|
||||
|
||||
matrix_mx_puppet_skype_database_connection_string: 'postgresql://{{ matrix_mx_puppet_skype_database_username }}:{{ matrix_mx_puppet_skype_database_password }}@{{ matrix_mx_puppet_skype_database_hostname }}:{{ matrix_mx_puppet_skype_database_port }}/{{ matrix_mx_puppet_skype_database_name }}?sslmode=disable'
|
||||
|
||||
# Default configuration template which covers the generic use case.
|
||||
# You can customize it by controlling the various variables inside it.
|
||||
#
|
||||
|
@ -8,14 +8,6 @@
|
||||
The matrix-bridge-mx-puppet-skype role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- name: Ensure MX Puppet Skype image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_skype_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_skype_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mx_puppet_skype_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_skype_enabled|bool and not matrix_mx_puppet_skype_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Skype paths exist
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
@ -30,25 +22,6 @@
|
||||
- { path: "{{ matrix_mx_puppet_skype_docker_src_files_path }}", when: "{{ matrix_mx_puppet_skype_container_image_self_build }}" }
|
||||
when: matrix_mx_puppet_skype_enabled|bool and item.when|bool
|
||||
|
||||
- name: Ensure MX Puppet Skype repository is present on self build
|
||||
git:
|
||||
repo: https://github.com/Sorunome/mx-puppet-skype.git
|
||||
dest: "{{ matrix_mx_puppet_skype_docker_src_files_path }}"
|
||||
force: "yes"
|
||||
register: matrix_mx_puppet_skype_git_pull_results
|
||||
when: "matrix_mx_puppet_skype_enabled|bool and matrix_mx_puppet_skype_container_image_self_build"
|
||||
|
||||
- name: Ensure MX Puppet Skype Docker image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_skype_docker_image }}"
|
||||
source: build
|
||||
force_source: yes
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_mx_puppet_skype_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_mx_puppet_skype_enabled|bool and matrix_mx_puppet_skype_container_image_self_build and matrix_mx_puppet_skype_git_pull_results.changed"
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_skype_base_path }}/database.db"
|
||||
@ -66,6 +39,59 @@
|
||||
command: "mv {{ matrix_mx_puppet_skype_base_path }}/database.db {{ matrix_mx_puppet_skype_data_path }}/database.db"
|
||||
when: "matrix_mx_puppet_skype_stat_database.stat.exists"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_skype_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_skype_sqlite_database_path_local }}"
|
||||
register: matrix_mx_puppet_skype_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mx_puppet_skype_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mx_puppet_skype_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mx_puppet_skype_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mx-puppet-skype.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_skype_requires_restart: true
|
||||
when: "matrix_mx_puppet_skype_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mx_puppet_skype_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure MX Puppet Skype image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_skype_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_skype_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mx_puppet_skype_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_skype_enabled|bool and not matrix_mx_puppet_skype_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Skype repository is present on self build
|
||||
git:
|
||||
repo: "{{ matrix_mx_puppet_skype_container_image_self_build_repo }}"
|
||||
dest: "{{ matrix_mx_puppet_skype_docker_src_files_path }}"
|
||||
force: "yes"
|
||||
register: matrix_mx_puppet_skype_git_pull_results
|
||||
when: "matrix_mx_puppet_skype_enabled|bool and matrix_mx_puppet_skype_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure MX Puppet Skype Docker image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_skype_docker_image }}"
|
||||
source: build
|
||||
force_source: "{{ matrix_mx_puppet_skype_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_mx_puppet_skype_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_mx_puppet_skype_enabled|bool and matrix_mx_puppet_skype_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure mx-puppet-skype config.yaml installed
|
||||
copy:
|
||||
content: "{{ matrix_mx_puppet_skype_configuration|to_nice_yaml }}"
|
||||
@ -93,3 +119,9 @@
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mx_puppet_skype_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mx-puppet-skype.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mx-puppet-skype.service"
|
||||
state: restarted
|
||||
when: "matrix_mx_puppet_skype_requires_restart|bool"
|
||||
|
@ -68,15 +68,18 @@ logging:
|
||||
# - Store
|
||||
|
||||
database:
|
||||
{% if matrix_mx_puppet_skype_database_engine == 'postgres' %}
|
||||
# Use Postgres as a database backend
|
||||
# If set, will be used instead of SQLite3
|
||||
# Connection string to connect to the Postgres instance
|
||||
# with username "user", password "pass", host "localhost" and database name "dbname".
|
||||
# Modify each value as necessary
|
||||
#connString: "postgres://user:pass@localhost/dbname?sslmode=disable"
|
||||
connString: {{ matrix_mx_puppet_skype_database_connection_string|to_json }}
|
||||
{% else %}
|
||||
# Use SQLite3 as a database backend
|
||||
# The name of the database file
|
||||
filename: /data/database.db
|
||||
filename: {{ matrix_mx_puppet_skype_sqlite_database_path_in_container|to_json }}
|
||||
{% endif %}
|
||||
|
||||
provisioning:
|
||||
# Regex of Matrix IDs allowed to use the puppet bridge
|
||||
|
@ -8,6 +8,7 @@ After={{ service }}
|
||||
{% for service in matrix_mx_puppet_skype_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
@ -4,13 +4,15 @@
|
||||
matrix_mx_puppet_slack_enabled: true
|
||||
|
||||
matrix_mx_puppet_slack_container_image_self_build: false
|
||||
matrix_mx_puppet_slack_container_image_self_build_repo: "https://github.com/Sorunome/mx-puppet-slack.git"
|
||||
|
||||
# Controls whether the mx-puppet-slack container exposes its HTTP port (tcp/8432 in the container).
|
||||
#
|
||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:8432"), or empty string to not expose.
|
||||
matrix_mx_puppet_slack_container_http_host_bind_port: ''
|
||||
|
||||
matrix_mx_puppet_slack_docker_image: "sorunome/mx-puppet-slack:latest"
|
||||
matrix_mx_puppet_slack_docker_image: "{{ matrix_mx_puppet_slack_docker_image_name_prefix }}sorunome/mx-puppet-slack:latest"
|
||||
matrix_mx_puppet_slack_docker_image_name_prefix: "{{ 'localhost/' if matrix_mx_puppet_slack_container_image_self_build else 'docker.io/' }}"
|
||||
matrix_mx_puppet_slack_docker_image_force_pull: "{{ matrix_mx_puppet_slack_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_mx_puppet_slack_base_path: "{{ matrix_base_data_path }}/mx-puppet-slack"
|
||||
@ -55,6 +57,20 @@ matrix_mx_puppet_slack_homeserver_token: ''
|
||||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mx_puppet_slack_login_shared_secret: ''
|
||||
|
||||
# Database configuration, role uses 'sqlite' per default but playbook sets up postgres by default
|
||||
matrix_mx_puppet_slack_database_engine: sqlite
|
||||
|
||||
matrix_mx_puppet_slack_sqlite_database_path_local: "{{ matrix_mx_puppet_slack_data_path }}/database.db"
|
||||
matrix_mx_puppet_slack_sqlite_database_path_in_container: "/data/database.db"
|
||||
|
||||
matrix_mx_puppet_slack_database_username: matrix_mx_puppet_slack
|
||||
matrix_mx_puppet_slack_database_password: ~
|
||||
matrix_mx_puppet_slack_database_hostname: 'matrix-postgres'
|
||||
matrix_mx_puppet_slack_database_port: 5432
|
||||
matrix_mx_puppet_slack_database_name: matrix_mx_puppet_slack
|
||||
|
||||
matrix_mx_puppet_slack_database_connection_string: 'postgresql://{{ matrix_mx_puppet_slack_database_username }}:{{ matrix_mx_puppet_slack_database_password }}@{{ matrix_mx_puppet_slack_database_hostname }}:{{ matrix_mx_puppet_slack_database_port }}/{{ matrix_mx_puppet_slack_database_name }}?sslmode=disable'
|
||||
|
||||
# Default configuration template which covers the generic use case.
|
||||
# You can customize it by controlling the various variables inside it.
|
||||
#
|
||||
|
@ -8,14 +8,6 @@
|
||||
The matrix-bridge-mx-puppet-slack role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- name: Ensure MX Puppet Slack image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_slack_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_slack_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mx_puppet_slack_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_slack_enabled|bool and not matrix_mx_puppet_slack_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Slack paths exist
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
@ -30,23 +22,6 @@
|
||||
- { path: "{{ matrix_mx_puppet_slack_docker_src_files_path }}", when: "{{ matrix_mx_puppet_slack_container_image_self_build }}" }
|
||||
when: matrix_mx_puppet_slack_enabled|bool and item.when|bool
|
||||
|
||||
- name: Ensure MX Puppet Slack repository is present on self build
|
||||
git:
|
||||
repo: https://github.com/Sorunome/mx-puppet-slack.git
|
||||
dest: "{{ matrix_mx_puppet_slack_docker_src_files_path }}"
|
||||
force: "yes"
|
||||
when: "matrix_mx_puppet_slack_enabled|bool and matrix_mx_puppet_slack_container_image_self_build"
|
||||
|
||||
- name: Ensure MX Puppet Slack Docker image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_slack_docker_image }}"
|
||||
source: build
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_mx_puppet_slack_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_mx_puppet_slack_enabled|bool and matrix_mx_puppet_slack_container_image_self_build"
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_slack_base_path }}/database.db"
|
||||
@ -60,6 +35,59 @@
|
||||
failed_when: false
|
||||
when: "matrix_mx_puppet_slack_stat_database.stat.exists"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_slack_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_slack_sqlite_database_path_local }}"
|
||||
register: matrix_mx_puppet_slack_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mx_puppet_slack_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mx_puppet_slack_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mx_puppet_slack_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mx-puppet-slack.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_slack_requires_restart: true
|
||||
when: "matrix_mx_puppet_slack_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mx_puppet_slack_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure MX Puppet Slack image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_slack_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_slack_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mx_puppet_slack_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_slack_enabled|bool and not matrix_mx_puppet_slack_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Slack repository is present on self build
|
||||
git:
|
||||
repo: "{{ matrix_mx_puppet_slack_container_image_self_build_repo }}"
|
||||
dest: "{{ matrix_mx_puppet_slack_docker_src_files_path }}"
|
||||
force: "yes"
|
||||
register: matrix_mx_puppet_slack_git_pull_results
|
||||
when: "matrix_mx_puppet_slack_enabled|bool and matrix_mx_puppet_slack_container_image_self_build"
|
||||
|
||||
- name: Ensure MX Puppet Slack Docker image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_slack_docker_image }}"
|
||||
source: build
|
||||
force_source: "{{ matrix_mx_puppet_slack_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_mx_puppet_slack_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_mx_puppet_slack_enabled|bool and matrix_mx_puppet_slack_container_image_self_build"
|
||||
|
||||
- name: (Data relocation) Move mx-puppet-slack database file to ./data directory
|
||||
command: "mv {{ matrix_mx_puppet_slack_base_path }}/database.db {{ matrix_mx_puppet_slack_data_path }}/database.db"
|
||||
when: "matrix_mx_puppet_slack_stat_database.stat.exists"
|
||||
@ -91,3 +119,9 @@
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mx_puppet_slack_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mx-puppet-slack.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mx-puppet-slack.service"
|
||||
state: restarted
|
||||
when: "matrix_mx_puppet_slack_requires_restart|bool"
|
||||
|
@ -58,15 +58,18 @@ provisioning:
|
||||
apiPrefix: /_matrix/provision
|
||||
|
||||
database:
|
||||
{% if matrix_mx_puppet_slack_database_engine == 'postgres' %}
|
||||
# Use Postgres as a database backend
|
||||
# If set, will be used instead of SQLite3
|
||||
# Connection string to connect to the Postgres instance
|
||||
# with username "user", password "pass", host "localhost" and database name "dbname".
|
||||
# Modify each value as necessary
|
||||
#connString: "postgres://user:pass@localhost/dbname?sslmode=disable"
|
||||
connString: {{ matrix_mx_puppet_slack_database_connection_string|to_json }}
|
||||
{% else %}
|
||||
# Use SQLite3 as a database backend
|
||||
# The name of the database file
|
||||
filename: /data/database.db
|
||||
filename: {{ matrix_mx_puppet_slack_sqlite_database_path_in_container|to_json }}
|
||||
{% endif %}
|
||||
|
||||
logging:
|
||||
# Log level of console output
|
||||
|
@ -8,6 +8,7 @@ After={{ service }}
|
||||
{% for service in matrix_mx_puppet_slack_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
@ -4,13 +4,15 @@
|
||||
matrix_mx_puppet_steam_enabled: true
|
||||
|
||||
matrix_mx_puppet_steam_container_image_self_build: false
|
||||
matrix_mx_puppet_steam_container_image_self_build_repo: "https://github.com/icewind1991/mx-puppet-steam.git"
|
||||
|
||||
# Controls whether the mx-puppet-steam container exposes its HTTP port (tcp/8432 in the container).
|
||||
#
|
||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:8432"), or empty string to not expose.
|
||||
matrix_mx_puppet_steam_container_http_host_bind_port: ''
|
||||
|
||||
matrix_mx_puppet_steam_docker_image: "icewind1991/mx-puppet-steam:latest"
|
||||
matrix_mx_puppet_steam_docker_image: "{{ matrix_mx_puppet_steam_docker_image_name_prefix }}icewind1991/mx-puppet-steam:latest"
|
||||
matrix_mx_puppet_steam_docker_image_name_prefix: "{{ 'localhost/' if matrix_mx_puppet_steam_container_image_self_build else 'docker.io/' }}"
|
||||
matrix_mx_puppet_steam_docker_image_force_pull: "{{ matrix_mx_puppet_steam_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_mx_puppet_steam_base_path: "{{ matrix_base_data_path }}/mx-puppet-steam"
|
||||
@ -53,6 +55,19 @@ matrix_mx_puppet_steam_homeserver_token: ''
|
||||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mx_puppet_steam_login_shared_secret: ''
|
||||
|
||||
matrix_mx_puppet_steam_database_engine: sqlite
|
||||
|
||||
matrix_mx_puppet_steam_sqlite_database_path_local: "{{ matrix_mx_puppet_steam_data_path }}/database.db"
|
||||
matrix_mx_puppet_steam_sqlite_database_path_in_container: "/data/database.db"
|
||||
|
||||
matrix_mx_puppet_steam_database_username: matrix_mx_puppet_steam
|
||||
matrix_mx_puppet_steam_database_password: ~
|
||||
matrix_mx_puppet_steam_database_hostname: 'matrix-postgres'
|
||||
matrix_mx_puppet_steam_database_port: 5432
|
||||
matrix_mx_puppet_steam_database_name: matrix_mx_puppet_steam
|
||||
|
||||
matrix_mx_puppet_steam_database_connection_string: 'postgresql://{{ matrix_mx_puppet_steam_database_username }}:{{ matrix_mx_puppet_steam_database_password }}@{{ matrix_mx_puppet_steam_database_hostname }}:{{ matrix_mx_puppet_steam_database_port }}/{{ matrix_mx_puppet_steam_database_name }}?sslmode=disable'
|
||||
|
||||
# Default configuration template which covers the generic use case.
|
||||
# You can customize it by controlling the various variables inside it.
|
||||
#
|
||||
|
@ -8,14 +8,6 @@
|
||||
The matrix-bridge-mx-puppet-steam role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- name: Ensure MX Puppet Steam image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_steam_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_steam_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mx_puppet_steam_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_steam_enabled|bool and not matrix_mx_puppet_steam_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Steam paths exist
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
@ -30,23 +22,6 @@
|
||||
- { path: "{{ matrix_mx_puppet_steam_docker_src_files_path }}", when: "{{ matrix_mx_puppet_steam_container_image_self_build }}" }
|
||||
when: matrix_mx_puppet_steam_enabled|bool and item.when|bool
|
||||
|
||||
- name: Ensure MX Puppet Steam repository is present on self build
|
||||
git:
|
||||
repo: https://github.com/icewind1991/mx-puppet-steam.git
|
||||
dest: "{{ matrix_mx_puppet_steam_docker_src_files_path }}"
|
||||
force: "yes"
|
||||
when: "matrix_mx_puppet_steam_enabled|bool and matrix_mx_puppet_steam_container_image_self_build"
|
||||
|
||||
- name: Ensure MX Puppet Steam Docker image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_steam_docker_image }}"
|
||||
source: build
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_mx_puppet_steam_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_mx_puppet_steam_enabled|bool and matrix_mx_puppet_steam_container_image_self_build"
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_steam_base_path }}/database.db"
|
||||
@ -64,6 +39,59 @@
|
||||
command: "mv {{ matrix_mx_puppet_steam_base_path }}/database.db {{ matrix_mx_puppet_steam_data_path }}/database.db"
|
||||
when: "matrix_mx_puppet_steam_stat_database.stat.exists"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_steam_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_steam_sqlite_database_path_local }}"
|
||||
register: matrix_mx_puppet_steam_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mx_puppet_steam_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mx_puppet_steam_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mx_puppet_steam_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mx-puppet-steam.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_steam_requires_restart: true
|
||||
when: "matrix_mx_puppet_steam_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mx_puppet_steam_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure MX Puppet Steam image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_steam_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_steam_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mx_puppet_steam_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_steam_enabled|bool and not matrix_mx_puppet_steam_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Steam repository is present on self build
|
||||
git:
|
||||
repo: "{{ matrix_mx_puppet_steam_container_image_self_build_repo }}"
|
||||
dest: "{{ matrix_mx_puppet_steam_docker_src_files_path }}"
|
||||
force: "yes"
|
||||
register: matrix_mx_puppet_steam_git_pull_results
|
||||
when: "matrix_mx_puppet_steam_enabled|bool and matrix_mx_puppet_steam_container_image_self_build"
|
||||
|
||||
- name: Ensure MX Puppet Steam Docker image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_steam_docker_image }}"
|
||||
source: build
|
||||
force_source: "{{ matrix_mx_puppet_steam_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_mx_puppet_steam_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_mx_puppet_steam_enabled|bool and matrix_mx_puppet_steam_container_image_self_build"
|
||||
|
||||
- name: Ensure mx-puppet-steam config.yaml installed
|
||||
copy:
|
||||
content: "{{ matrix_mx_puppet_steam_configuration|to_nice_yaml }}"
|
||||
@ -91,3 +119,9 @@
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mx_puppet_steam_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mx-puppet-steam.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mx-puppet-steam.service"
|
||||
state: restarted
|
||||
when: "matrix_mx_puppet_steam_requires_restart|bool"
|
||||
|
@ -61,15 +61,18 @@ selfService:
|
||||
blacklist: {{ matrix_mx_puppet_steam_provisioning_blacklist|to_json }}
|
||||
|
||||
database:
|
||||
{% if matrix_mx_puppet_steam_database_engine == 'postgres' %}
|
||||
# Use Postgres as a database backend
|
||||
# If set, will be used instead of SQLite3
|
||||
# Connection string to connect to the Postgres instance
|
||||
# with username "user", password "pass", host "localhost" and database name "dbname".
|
||||
# Modify each value as necessary
|
||||
#connString: "postgres://user:pass@localhost/dbname?sslmode=disable"
|
||||
connString: {{ matrix_mx_puppet_steam_database_connection_string|to_json }}
|
||||
{% else %}
|
||||
# Use SQLite3 as a database backend
|
||||
# The name of the database file
|
||||
filename: /data/database.db
|
||||
filename: {{ matrix_mx_puppet_steam_sqlite_database_path_in_container|to_json }}
|
||||
{% endif %}
|
||||
|
||||
logging:
|
||||
# Log level of console output
|
||||
|
@ -8,6 +8,7 @@ After={{ service }}
|
||||
{% for service in matrix_mx_puppet_steam_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
@ -4,13 +4,15 @@
|
||||
matrix_mx_puppet_twitter_enabled: true
|
||||
|
||||
matrix_mx_puppet_twitter_container_image_self_build: false
|
||||
matrix_mx_puppet_twitter_container_image_self_build_repo: "https://github.com/Sorunome/mx-puppet-twitter.git"
|
||||
|
||||
# Controls whether the mx-puppet-twitter container exposes its HTTP port (tcp/8432 in the container).
|
||||
#
|
||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:8432"), or empty string to not expose.
|
||||
matrix_mx_puppet_twitter_container_http_host_bind_port: ''
|
||||
|
||||
matrix_mx_puppet_twitter_docker_image: "sorunome/mx-puppet-twitter:latest"
|
||||
matrix_mx_puppet_twitter_docker_image: "{{ matrix_mx_puppet_twitter_docker_image_name_prefix }}sorunome/mx-puppet-twitter:latest"
|
||||
matrix_mx_puppet_twitter_docker_image_name_prefix: "{{ 'localhost/' if matrix_mx_puppet_twitter_container_image_self_build else 'docker.io/' }}"
|
||||
matrix_mx_puppet_twitter_docker_image_force_pull: "{{ matrix_mx_puppet_twitter_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_mx_puppet_twitter_base_path: "{{ matrix_base_data_path }}/mx-puppet-twitter"
|
||||
@ -58,6 +60,20 @@ matrix_mx_puppet_twitter_homeserver_token: ''
|
||||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mx_puppet_twitter_login_shared_secret: ''
|
||||
|
||||
# Database configuration
|
||||
matrix_mx_puppet_twitter_database_engine: sqlite
|
||||
|
||||
matrix_mx_puppet_twitter_sqlite_database_path_local: "{{ matrix_mx_puppet_twitter_data_path }}/database.db"
|
||||
matrix_mx_puppet_twitter_sqlite_database_path_in_container: "/data/database.db"
|
||||
|
||||
matrix_mx_puppet_twitter_database_username: mx_puppet_twitter
|
||||
matrix_mx_puppet_twitter_database_password: ~
|
||||
matrix_mx_puppet_twitter_database_hostname: 'matrix-postgres'
|
||||
matrix_mx_puppet_twitter_database_port: 5432
|
||||
matrix_mx_puppet_twitter_database_name: matrix_mx_puppet_twitter
|
||||
|
||||
matrix_mx_puppet_twitter_database_connection_string: 'postgresql://{{ matrix_mx_puppet_twitter_database_username }}:{{ matrix_mx_puppet_twitter_database_password }}@{{ matrix_mx_puppet_twitter_database_hostname }}:{{ matrix_mx_puppet_twitter_database_port }}/{{ matrix_mx_puppet_twitter_database_name }}?sslmode=disable'
|
||||
|
||||
# Default configuration template which covers the generic use case.
|
||||
# You can customize it by controlling the various variables inside it.
|
||||
#
|
||||
|
@ -8,14 +8,6 @@
|
||||
The matrix-bridge-mx-puppet-twitter role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- name: Ensure MX Puppet Twitter image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_twitter_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_twitter_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mx_puppet_twitter_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_twitter_enabled|bool and not matrix_mx_puppet_twitter_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Twitter paths exist
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
@ -30,23 +22,6 @@
|
||||
- { path: "{{ matrix_mx_puppet_twitter_docker_src_files_path }}", when: "{{ matrix_mx_puppet_twitter_container_image_self_build }}" }
|
||||
when: matrix_mx_puppet_twitter_enabled|bool and item.when|bool
|
||||
|
||||
- name: Ensure MX Puppet Twitter repository is present on self build
|
||||
git:
|
||||
repo: https://github.com/Sorunome/mx-puppet-twitter.git
|
||||
dest: "{{ matrix_mx_puppet_twitter_docker_src_files_path }}"
|
||||
force: "yes"
|
||||
when: "matrix_mx_puppet_twitter_enabled|bool and matrix_mx_puppet_twitter_container_image_self_build"
|
||||
|
||||
- name: Ensure MX Puppet Twitter Docker image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_twitter_docker_image }}"
|
||||
source: build
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_mx_puppet_twitter_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_mx_puppet_twitter_enabled|bool and matrix_mx_puppet_twitter_container_image_self_build"
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_twitter_base_path }}/database.db"
|
||||
@ -64,6 +39,59 @@
|
||||
command: "mv {{ matrix_mx_puppet_twitter_base_path }}/database.db {{ matrix_mx_puppet_twitter_data_path }}/database.db"
|
||||
when: "matrix_mx_puppet_twitter_stat_database.stat.exists"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_twitter_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_twitter_sqlite_database_path_local }}"
|
||||
register: matrix_mx_puppet_twitter_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mx_puppet_twitter_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mx_puppet_twitter_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mx_puppet_twitter_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mx-puppet-twitter.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_twitter_requires_restart: true
|
||||
when: "matrix_mx_puppet_twitter_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mx_puppet_twitter_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure MX Puppet Twitter image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_twitter_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_twitter_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mx_puppet_twitter_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_twitter_enabled|bool and not matrix_mx_puppet_twitter_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Twitter repository is present on self build
|
||||
git:
|
||||
repo: "{{ matrix_mx_puppet_twitter_container_image_self_build_repo }}"
|
||||
dest: "{{ matrix_mx_puppet_twitter_docker_src_files_path }}"
|
||||
force: "yes"
|
||||
register: matrix_mx_puppet_twitter_git_pull_results
|
||||
when: "matrix_mx_puppet_twitter_enabled|bool and matrix_mx_puppet_twitter_container_image_self_build"
|
||||
|
||||
- name: Ensure MX Puppet Twitter Docker image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_twitter_docker_image }}"
|
||||
source: build
|
||||
force_source: "{{ matrix_mx_puppet_twitter_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_mx_puppet_twitter_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_mx_puppet_twitter_enabled|bool and matrix_mx_puppet_twitter_container_image_self_build"
|
||||
|
||||
- name: Ensure mx-puppet-twitter config.yaml installed
|
||||
copy:
|
||||
content: "{{ matrix_mx_puppet_twitter_configuration|to_nice_yaml }}"
|
||||
@ -91,3 +119,9 @@
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mx_puppet_twitter_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mx-puppet-twitter.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mx-puppet-twitter.service"
|
||||
state: restarted
|
||||
when: "matrix_mx_puppet_twitter_requires_restart|bool"
|
||||
|
@ -54,15 +54,18 @@ provisioning:
|
||||
apiPrefix: /_matrix/provision
|
||||
|
||||
database:
|
||||
{% if matrix_mx_puppet_twitter_database_engine == 'postgres' %}
|
||||
# Use Postgres as a database backend
|
||||
# If set, will be used instead of SQLite3
|
||||
# Connection string to connect to the Postgres instance
|
||||
# with username "user", password "pass", host "localhost" and database name "dbname".
|
||||
# Modify each value as necessary
|
||||
#connString: "postgres://user:pass@localhost/dbname?sslmode=disable"
|
||||
connString: {{ matrix_mx_puppet_twitter_database_connection_string|to_json }}
|
||||
{% else %}
|
||||
# Use SQLite3 as a database backend
|
||||
# The name of the database file
|
||||
filename: /data/database.db
|
||||
filename: {{ matrix_mx_puppet_twitter_sqlite_database_path_in_container|to_json }}
|
||||
{% endif %}
|
||||
|
||||
logging:
|
||||
# Log level of console output
|
||||
|
@ -8,6 +8,7 @@ After={{ service }}
|
||||
{% for service in matrix_mx_puppet_twitter_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
@ -3,43 +3,27 @@
|
||||
|
||||
matrix_sms_bridge_enabled: true
|
||||
|
||||
matrix_sms_bridge_docker_image: "folivonet/matrix-sms-bridge:0.3.2.RELEASE"
|
||||
matrix_sms_bridge_database_docker_image: "neo4j:latest"
|
||||
matrix_sms_bridge_database_docker_image_force_pull: "{{ matrix_sms_bridge_docker_image.endswith(':latest') }}"
|
||||
matrix_sms_bridge_docker_image: "docker.io/folivonet/matrix-sms-bridge:0.5.5"
|
||||
|
||||
matrix_sms_bridge_base_path: "{{ matrix_base_data_path }}/matrix-sms-bridge"
|
||||
matrix_sms_bridge_config_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/config"
|
||||
matrix_sms_bridge_data_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/data"
|
||||
matrix_sms_bridge_data_log_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/data/log"
|
||||
matrix_sms_bridge_data_spool_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/data/spool"
|
||||
matrix_sms_bridge_data_spool_inbox_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/data/spool/inbox"
|
||||
matrix_sms_bridge_data_spool_inbox_processed_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/data/spool/inbox_processed"
|
||||
matrix_sms_bridge_data_spool_outbox_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/data/spool/outbox"
|
||||
matrix_sms_bridge_data_spool_sent_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/data/spool/sent"
|
||||
matrix_sms_bridge_data_spool_error_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/data/spool/error"
|
||||
matrix_sms_bridge_database_path: "{{ matrix_base_data_path }}/matrix-sms-bridge/database"
|
||||
|
||||
matrix_sms_bridge_appservice_token: ''
|
||||
matrix_sms_bridge_homeserver_token: ''
|
||||
|
||||
matrix_sms_bridge_database_username: 'neo4j'
|
||||
matrix_sms_bridge_database_password: ''
|
||||
|
||||
matrix_sms_bridge_container_http_host_bind_port: ''
|
||||
|
||||
# A list of extra arguments to pass to the container
|
||||
matrix_sms_bridge_container_extra_arguments: []
|
||||
|
||||
# List of systemd services that service depends on.
|
||||
matrix_sms_bridge_systemd_required_services_list: ['docker.service','matrix-sms-bridge-database.service']
|
||||
matrix_sms_bridge_database_systemd_required_services_list: ['docker.service']
|
||||
matrix_sms_bridge_systemd_required_services_list: ['docker.service']
|
||||
|
||||
# List of systemd services that service wants
|
||||
matrix_sms_bridge_systemd_wanted_services_list: []
|
||||
matrix_sms_bridge_database_systemd_wanted_services_list: []
|
||||
|
||||
matrix_sms_bridge_appservice_url: 'http://matrix-sms-bridge:8080'
|
||||
matrix_sms_bridge_database_url: 'bolt://matrix-sms-bridge-database:7687'
|
||||
matrix_sms_bridge_homeserver_hostname: 'matrix-synapse'
|
||||
matrix_sms_bridge_homeserver_port: '8008'
|
||||
|
||||
@ -47,25 +31,19 @@ matrix_sms_bridge_homserver_domain: "{{ matrix_domain }}"
|
||||
matrix_sms_bridge_default_room: ''
|
||||
matrix_sms_bridge_default_region: ''
|
||||
matrix_sms_bridge_default_timezone: ''
|
||||
matrix_sms_bridge_single_mode_enabled: false
|
||||
|
||||
matrix_sms_bridge_gammu_modem: ''
|
||||
matrix_sms_bridge_modem_group: 'dialout'
|
||||
matrix_sms_bridge_gammu_reset_frequency: 0
|
||||
matrix_sms_bridge_gammu_hard_reset_frequency: 0
|
||||
matrix_sms_bridge_provider_android_baseurl: ''
|
||||
matrix_sms_bridge_provider_android_username: ''
|
||||
matrix_sms_bridge_provider_android_password: ''
|
||||
matrix_sms_bridge_provider_android_truststore_local_path: ''
|
||||
matrix_sms_bridge_provider_android_truststore_password: ''
|
||||
|
||||
|
||||
matrix_sms_bridge_configuration_yaml: |
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
|
||||
# Database connection
|
||||
org:
|
||||
neo4j:
|
||||
driver:
|
||||
uri: {{ matrix_sms_bridge_database_url }}
|
||||
authentication:
|
||||
username: {{ matrix_sms_bridge_database_username }}
|
||||
password: {{ matrix_sms_bridge_database_password }}
|
||||
|
||||
matrix:
|
||||
bridge:
|
||||
sms:
|
||||
@ -74,17 +52,33 @@ matrix_sms_bridge_configuration_yaml: |
|
||||
defaultRoomId: "{{ matrix_sms_bridge_default_room }}"
|
||||
defaultRegion: "{{ matrix_sms_bridge_default_region }}"
|
||||
defaultTimeZone: "{{ matrix_sms_bridge_default_timezone }}"
|
||||
singleModeEnabled: "{{ matrix_sms_bridge_single_mode_enabled }}"
|
||||
provider:
|
||||
gammu:
|
||||
android:
|
||||
# (optional) default is disabled
|
||||
enabled: true
|
||||
# (optional) Path to the Gammu-Inbox directory.
|
||||
inboxPath: /data/spool/inbox
|
||||
# (optional) Path to the directory, where to put processed messages.
|
||||
inboxProcessedPath: /data/spool/inbox_processed
|
||||
# The url to the android-sms-gateway-server
|
||||
baseUrl: {{ matrix_sms_bridge_provider_android_baseurl }}
|
||||
# The username of the gateway
|
||||
username: {{ matrix_sms_bridge_provider_android_username }}
|
||||
# The password of the gateway
|
||||
password: {{ matrix_sms_bridge_provider_android_password }}
|
||||
# (optional) if you use a self signed certificate, you can add the public key here
|
||||
{% if matrix_sms_bridge_provider_android_truststore_local_path %}
|
||||
trustStore:
|
||||
path: /config/matrix-sms-gateway-server.p12
|
||||
password: {{ matrix_sms_bridge_provider_android_truststore_password }}
|
||||
type: PKCS12
|
||||
{% endif %}
|
||||
bot:
|
||||
# The domain-part of matrix-ids. E. g. example.org when your userIds look like @unicorn:example.org
|
||||
serverName: {{ matrix_sms_bridge_homserver_domain }}
|
||||
migration:
|
||||
url: "jdbc:h2:file:/data/database/db"
|
||||
username: sa
|
||||
database:
|
||||
url: "r2dbc:h2:file:////data/database/db"
|
||||
username: sa
|
||||
client:
|
||||
homeServer:
|
||||
# The hostname of your Homeserver.
|
||||
@ -112,31 +106,6 @@ matrix_sms_bridge_configuration_extension: "{{ matrix_sms_bridge_configuration_e
|
||||
|
||||
matrix_sms_bridge_configuration: "{{ matrix_sms_bridge_configuration_yaml|from_yaml|combine(matrix_sms_bridge_configuration_extension, recursive=True) }}"
|
||||
|
||||
matrix_sms_bridge_gammu_configuration: |
|
||||
[gammu]
|
||||
Device = {{ matrix_sms_bridge_gammu_modem }}
|
||||
LogFile = /data/log/gammu.log
|
||||
debugLevel = 1
|
||||
|
||||
[smsd]
|
||||
Service = files
|
||||
LoopSleep = 2
|
||||
InboxPath = /data/spool/inbox/
|
||||
OutboxPath = /data/spool/outbox/
|
||||
SentSMSPath = /data/spool/sent/
|
||||
ErrorSMSPath = /data/spool/error/
|
||||
InboxFormat = detail
|
||||
OutboxFormat = detail
|
||||
TransmitFormat = auto
|
||||
ResetFrequency = {{ matrix_sms_bridge_gammu_reset_frequency }}
|
||||
HardResetFrequency = {{ matrix_sms_bridge_gammu_hard_reset_frequency }}
|
||||
debugLevel = 1
|
||||
LogFile = /data/log/smsd.log
|
||||
DeliveryReport = no
|
||||
HangupCalls = 1
|
||||
CheckBattery = 0
|
||||
|
||||
|
||||
matrix_sms_bridge_registration_yaml: |
|
||||
id: sms
|
||||
as_token: "{{ matrix_sms_bridge_appservice_token }}"
|
||||
@ -145,6 +114,9 @@ matrix_sms_bridge_registration_yaml: |
|
||||
users:
|
||||
- exclusive: true
|
||||
regex: '^@sms_.+:{{ matrix_sms_bridge_homserver_domain|regex_escape }}$'
|
||||
aliases:
|
||||
- exclusive: true
|
||||
regex: '^#sms_.+:{{ matrix_sms_bridge_homserver_domain|regex_escape }}$'
|
||||
url: {{ matrix_sms_bridge_appservice_url }}
|
||||
sender_localpart: smsbot
|
||||
rate_limited: false
|
||||
|
@ -7,7 +7,7 @@
|
||||
when: "matrix_sms_bridge_enabled and matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-sms-bridge','matrix-sms-bridge-database'] }}"
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-sms-bridge'] }}"
|
||||
when: matrix_sms_bridge_enabled|bool
|
||||
|
||||
# If the matrix-synapse role is not used, these variables may not exist.
|
||||
|
@ -5,14 +5,6 @@
|
||||
name: "{{ matrix_sms_bridge_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
|
||||
- name: Ensure matrix-sms-bridge databse image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_sms_bridge_database_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_sms_bridge_database_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_sms_bridge_database_docker_image_force_pull }}"
|
||||
|
||||
|
||||
- name: Ensure matrix-sms-bridge paths exist
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
@ -24,14 +16,6 @@
|
||||
- "{{ matrix_sms_bridge_base_path }}"
|
||||
- "{{ matrix_sms_bridge_config_path }}"
|
||||
- "{{ matrix_sms_bridge_data_path }}"
|
||||
- "{{ matrix_sms_bridge_data_log_path }}"
|
||||
- "{{ matrix_sms_bridge_data_spool_path }}"
|
||||
- "{{ matrix_sms_bridge_data_spool_inbox_path }}"
|
||||
- "{{ matrix_sms_bridge_data_spool_inbox_processed_path }}"
|
||||
- "{{ matrix_sms_bridge_data_spool_outbox_path }}"
|
||||
- "{{ matrix_sms_bridge_data_spool_sent_path }}"
|
||||
- "{{ matrix_sms_bridge_data_spool_error_path }}"
|
||||
- "{{ matrix_sms_bridge_database_path }}"
|
||||
|
||||
- name: Ensure matrix-sms-bridge application.yml installed
|
||||
copy:
|
||||
@ -49,13 +33,14 @@
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
- name: Ensure matrix-sms-bridge gammu-smsdrc installed
|
||||
- name: Ensure android-sms-gateway-server cert installed
|
||||
copy:
|
||||
content: "{{ matrix_sms_bridge_gammu_configuration }}"
|
||||
dest: "{{ matrix_sms_bridge_config_path }}/gammu-smsdrc"
|
||||
src: "{{ matrix_sms_bridge_provider_android_truststore_local_path }}"
|
||||
dest: "{{ matrix_sms_bridge_config_path }}/matrix-sms-gateway-server.p12"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
when: matrix_sms_bridge_provider_android_truststore_local_path != ""
|
||||
|
||||
- name: Ensure matrix-sms-bridge.service installed
|
||||
template:
|
||||
@ -64,14 +49,7 @@
|
||||
mode: 0644
|
||||
register: matrix_sms_bridge_systemd_service_result
|
||||
|
||||
- name: Ensure matrix-sms-bridge-database.service installed
|
||||
template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-sms-bridge-database.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/matrix-sms-bridge-database.service"
|
||||
mode: 0644
|
||||
register: matrix_sms_bridge_database_systemd_service_result
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-sms-bridge.service or matrix-sms-bridge-database.service installation
|
||||
- name: Ensure systemd reloaded after matrix-sms-bridge.service installation
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: matrix_sms_bridge_systemd_service_result.changed or matrix_sms_bridge_database_systemd_service_result.changed
|
||||
when: matrix_sms_bridge_systemd_service_result.changed
|
@ -5,11 +5,6 @@
|
||||
path: "{{ matrix_systemd_path }}/matrix-sms-bridge.service"
|
||||
register: matrix_sms_bridge_service_stat
|
||||
|
||||
- name: Check existence of matrix-sms-bridge-database service
|
||||
stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-sms-bridge-database.service"
|
||||
register: matrix_sms_bridge_database_service_stat
|
||||
|
||||
- name: Ensure matrix-sms-bridge is stopped
|
||||
service:
|
||||
name: matrix-sms-bridge
|
||||
@ -17,26 +12,8 @@
|
||||
daemon_reload: yes
|
||||
when: "matrix_sms_bridge_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-sms-bridge-database is stopped
|
||||
service:
|
||||
name: matrix-sms-bridge-database
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
when: "matrix_sms_bridge_database_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-sms-bridge.service doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-sms-bridge.service"
|
||||
state: absent
|
||||
when: "matrix_sms_bridge_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-sms-bridge-database.service doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-sms-bridge-database.service"
|
||||
state: absent
|
||||
when: "matrix_sms_bridge_database_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-sms-bridge.service or matrix-sms-bridge-database.service removal
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: matrix_sms_bridge_service_stat.stat.exists or matrix_sms_bridge_database_service_stat.stat.exists
|
||||
when: "matrix_sms_bridge_service_stat.stat.exists"
|
@ -8,7 +8,8 @@
|
||||
with_items:
|
||||
- "matrix_sms_bridge_appservice_token"
|
||||
- "matrix_sms_bridge_homeserver_token"
|
||||
- "matrix_sms_bridge_database_password"
|
||||
- "matrix_sms_bridge_gammu_modem"
|
||||
- "matrix_sms_bridge_default_region"
|
||||
- "matrix_sms_bridge_default_timezone"
|
||||
- "matrix_sms_bridge_provider_android_baseurl"
|
||||
- "matrix_sms_bridge_provider_android_username"
|
||||
- "matrix_sms_bridge_provider_android_password"
|
@ -1,36 +0,0 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=Matrix sms bridge database
|
||||
{% for service in matrix_sms_bridge_database_systemd_required_services_list %}
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
{% for service in matrix_sms_bridge_database_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStartPre=-/usr/bin/docker kill matrix-sms-bridge-database
|
||||
ExecStartPre=-/usr/bin/docker rm matrix-sms-bridge-database
|
||||
|
||||
# Intentional delay, so that the homeserver (we likely depend on) can manage to start.
|
||||
ExecStartPre=/bin/sleep 5
|
||||
|
||||
ExecStart=/usr/bin/docker run --rm --name matrix-sms-bridge-database \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--network={{ matrix_docker_network }} \
|
||||
-v {{ matrix_sms_bridge_database_path }}:/data:z \
|
||||
-e NEO4J_AUTH={{ matrix_sms_bridge_database_username }}/{{ matrix_sms_bridge_database_password }} \
|
||||
{{ matrix_sms_bridge_database_docker_image }}
|
||||
|
||||
ExecStop=-/usr/bin/docker kill matrix-sms-bridge-database
|
||||
ExecStop=-/usr/bin/docker rm matrix-sms-bridge-database
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier=matrix-sms-bridge
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -8,6 +8,7 @@ After={{ service }}
|
||||
{% for service in matrix_sms_bridge_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
@ -20,7 +21,6 @@ ExecStartPre=/bin/sleep 5
|
||||
ExecStart=/usr/bin/docker run --rm --name matrix-sms-bridge \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--group-add {{ matrix_sms_bridge_modem_group }} \
|
||||
--cap-drop=ALL \
|
||||
--network={{ matrix_docker_network }} \
|
||||
{% if matrix_sms_bridge_container_http_host_bind_port %}
|
||||
@ -28,9 +28,7 @@ ExecStart=/usr/bin/docker run --rm --name matrix-sms-bridge \
|
||||
{% endif %}
|
||||
-v {{ matrix_sms_bridge_config_path }}:/config:z \
|
||||
-v {{ matrix_sms_bridge_data_path }}:/data:z \
|
||||
-v {{ matrix_sms_bridge_config_path }}/gammu-smsdrc:/etc/gammu-smsdrc:z \
|
||||
--privileged \
|
||||
-v /dev:/dev:slave \
|
||||
--env SPRING_CONFIG_ADDITIONAL_LOCATION=/config/application.yml \
|
||||
{% for arg in matrix_sms_bridge_container_extra_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
|
@ -1,8 +1,10 @@
|
||||
matrix_client_element_enabled: true
|
||||
|
||||
matrix_client_element_container_image_self_build: false
|
||||
matrix_client_element_container_image_self_build_repo: "https://github.com/vector-im/riot-web.git"
|
||||
|
||||
matrix_client_element_docker_image: "vectorim/riot-web:v1.7.10"
|
||||
matrix_client_element_docker_image: "{{ matrix_client_element_docker_image_name_prefix }}vectorim/element-web:v1.7.16"
|
||||
matrix_client_element_docker_image_name_prefix: "{{ 'localhost/' if matrix_client_element_container_image_self_build else 'docker.io/' }}"
|
||||
matrix_client_element_docker_image_force_pull: "{{ matrix_client_element_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_client_element_data_path: "{{ matrix_base_data_path }}/client-element"
|
||||
|
@ -26,21 +26,23 @@
|
||||
|
||||
- name: Ensure Element repository is present on self-build
|
||||
git:
|
||||
repo: https://github.com/vector-im/riot-web.git
|
||||
repo: "{{ matrix_client_element_container_image_self_build_repo }}"
|
||||
dest: "{{ matrix_client_element_docker_src_files_path }}"
|
||||
version: "{{ matrix_client_element_docker_image.split(':')[1] }}"
|
||||
force: "yes"
|
||||
when: "matrix_client_element_enabled|bool and matrix_client_element_container_image_self_build"
|
||||
register: matrix_client_element_git_pull_results
|
||||
when: "matrix_client_element_enabled|bool and matrix_client_element_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure Element Docker image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_client_element_docker_image }}"
|
||||
source: build
|
||||
force_source: "{{ matrix_client_element_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_client_element_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_client_element_enabled|bool and matrix_client_element_container_image_self_build"
|
||||
when: "matrix_client_element_enabled|bool and matrix_client_element_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure Element configuration installed
|
||||
copy:
|
||||
|
@ -5,6 +5,7 @@ Description=Matrix Element server
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
@ -21,13 +22,13 @@ ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-client-element
|
||||
-p {{ matrix_client_element_container_http_host_bind_port }}:8080 \
|
||||
{% endif %}
|
||||
--tmpfs=/tmp:rw,noexec,nosuid,size=10m \
|
||||
-v {{ matrix_client_element_data_path }}/nginx.conf:/etc/nginx/nginx.conf:ro \
|
||||
-v {{ matrix_client_element_data_path }}/config.json:/app/config.json:ro \
|
||||
-v {{ matrix_client_element_data_path }}/config.json:/app/config.{{ matrix_server_fqn_element }}.json:ro \
|
||||
--mount type=bind,src={{ matrix_client_element_data_path }}/nginx.conf,dst=/etc/nginx/nginx.conf,ro \
|
||||
--mount type=bind,src={{ matrix_client_element_data_path }}/config.json,dst=/app/config.json,ro \
|
||||
--mount type=bind,src={{ matrix_client_element_data_path }}/config.json,dst=/app/config.{{ matrix_server_fqn_element }}.json,ro \
|
||||
{% if matrix_client_element_embedded_pages_home_path is not none %}
|
||||
-v {{ matrix_client_element_data_path }}/home.html:/app/home.html:ro \
|
||||
--mount type=bind,src={{ matrix_client_element_data_path }}/home.html,dst=/app/home.html,ro \
|
||||
{% endif %}
|
||||
-v {{ matrix_client_element_data_path }}/welcome.html:/app/welcome.html:ro \
|
||||
--mount type=bind,src={{ matrix_client_element_data_path }}/welcome.html,dst=/app/welcome.html,ro \
|
||||
{% for arg in matrix_client_element_container_extra_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
|
@ -1,5 +1,9 @@
|
||||
---
|
||||
|
||||
- name: Deterimne whether we should make services autostart
|
||||
set_fact:
|
||||
matrix_services_autostart_enabled_bool: "{{ true if matrix_services_autostart_enabled|default('') == '' else matrix_services_autostart_enabled|bool }}"
|
||||
|
||||
- name: Ensure systemd is reloaded
|
||||
service:
|
||||
daemon_reload: yes
|
||||
@ -14,7 +18,7 @@
|
||||
- name: Ensure Matrix services are started
|
||||
service:
|
||||
name: "{{ item }}"
|
||||
enabled: yes
|
||||
enabled: "{{ matrix_services_autostart_enabled_bool }}"
|
||||
state: started
|
||||
with_items: "{{ matrix_systemd_services_list }}"
|
||||
when: not ansible_check_mode
|
||||
|
@ -3,6 +3,9 @@
|
||||
|
||||
matrix_corporal_enabled: true
|
||||
|
||||
matrix_corporal_container_image_self_build: false
|
||||
matrix_corporal_container_image_self_build_repo: "https://github.com/devture/matrix-corporal.git"
|
||||
|
||||
# Controls whether the matrix-corporal container exposes its gateway HTTP port (tcp/41080 in the container).
|
||||
#
|
||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:41080"), or empty string to not expose.
|
||||
@ -19,10 +22,13 @@ matrix_corporal_container_extra_arguments: []
|
||||
# List of systemd services that matrix-corporal.service depends on
|
||||
matrix_corporal_systemd_required_services_list: ['docker.service']
|
||||
|
||||
matrix_corporal_docker_image: "devture/matrix-corporal:1.11.0"
|
||||
matrix_corporal_docker_image: "{{ matrix_corporal_docker_image_name_prefix }}devture/matrix-corporal:{{ matrix_corporal_docker_image_tag }}"
|
||||
matrix_corporal_docker_image_name_prefix: "{{ 'localhost/' if matrix_corporal_container_image_self_build else 'docker.io/' }}"
|
||||
matrix_corporal_docker_image_tag: "1.11.0"
|
||||
matrix_corporal_docker_image_force_pull: "{{ matrix_corporal_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_corporal_base_path: "{{ matrix_base_data_path }}/corporal"
|
||||
matrix_corporal_container_src_files_path: "{{ matrix_corporal_base_path }}/container-src"
|
||||
matrix_corporal_config_dir_path: "{{ matrix_corporal_base_path }}/config"
|
||||
matrix_corporal_cache_dir_path: "{{ matrix_corporal_base_path }}/cache"
|
||||
matrix_corporal_var_dir_path: "{{ matrix_corporal_base_path }}/var"
|
||||
|
@ -17,13 +17,33 @@
|
||||
- "{{ matrix_corporal_var_dir_path }}"
|
||||
when: matrix_corporal_enabled|bool
|
||||
|
||||
- name: Ensure Matrix Corporal repository is present on self-build
|
||||
git:
|
||||
repo: "{{ matrix_corporal_container_image_self_build_repo }}"
|
||||
dest: "{{ matrix_corporal_container_src_files_path }}"
|
||||
version: "{{ matrix_corporal_docker_image.split(':')[1] }}"
|
||||
force: "yes"
|
||||
register: matrix_corporal_git_pull_results
|
||||
when: "matrix_corporal_enabled|bool and matrix_corporal_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure Matrix Corporal Docker image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_corporal_docker_image }}"
|
||||
source: build
|
||||
force_source: "{{ matrix_corporal_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: etc/docker/Dockerfile
|
||||
path: "{{ matrix_corporal_container_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_corporal_enabled|bool and matrix_corporal_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure Matrix Corporal Docker image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_corporal_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_corporal_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_corporal_docker_image_force_pull }}"
|
||||
when: matrix_corporal_enabled|bool
|
||||
when: "matrix_corporal_enabled|bool and not matrix_corporal_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure Matrix Corporal config installed
|
||||
copy:
|
||||
|
@ -5,6 +5,7 @@ Description=Matrix Corporal
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
@ -23,9 +24,9 @@ ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-corporal \
|
||||
{% if matrix_corporal_container_http_api_host_bind_port %}
|
||||
-p {{ matrix_corporal_container_http_api_host_bind_port }}:41081 \
|
||||
{% endif %}
|
||||
-v {{ matrix_corporal_config_dir_path }}:/etc/matrix-corporal:ro \
|
||||
-v {{ matrix_corporal_cache_dir_path }}:/var/cache/matrix-corporal:rw \
|
||||
-v {{ matrix_corporal_var_dir_path }}:/var/matrix-corporal:rw \
|
||||
--mount type=bind,src={{ matrix_corporal_config_dir_path }},dst=/etc/matrix-corporal,ro \
|
||||
--mount type=bind,src={{ matrix_corporal_cache_dir_path }},dst=/var/cache/matrix-corporal \
|
||||
--mount type=bind,src={{ matrix_corporal_var_dir_path }},dst=/var/matrix-corporal \
|
||||
{% for arg in matrix_corporal_container_extra_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
|
@ -1,8 +1,10 @@
|
||||
matrix_coturn_enabled: true
|
||||
|
||||
matrix_coturn_container_image_self_build: false
|
||||
matrix_coturn_container_image_self_build_repo: "https://github.com/instrumentisto/coturn-docker-image.git"
|
||||
|
||||
matrix_coturn_docker_image: "instrumentisto/coturn:4.5.1.3"
|
||||
matrix_coturn_docker_image: "{{ matrix_coturn_docker_image_name_prefix }}instrumentisto/coturn:4.5.1.3"
|
||||
matrix_coturn_docker_image_name_prefix: "{{ 'localhost/' if matrix_coturn_container_image_self_build else 'docker.io/' }}"
|
||||
matrix_coturn_docker_image_force_pull: "{{ matrix_coturn_docker_image.endswith(':latest') }}"
|
||||
|
||||
# The Docker network that Coturn would be put into.
|
||||
|
@ -25,21 +25,23 @@
|
||||
|
||||
- name: Ensure Coturn repository is present on self-build
|
||||
git:
|
||||
repo: https://github.com/instrumentisto/coturn-docker-image.git
|
||||
repo: "{{ matrix_coturn_container_image_self_build_repo }}"
|
||||
dest: "{{ matrix_coturn_docker_src_files_path }}"
|
||||
version: "{{ matrix_coturn_docker_image.split(':')[1] }}"
|
||||
force: "yes"
|
||||
register: matrix_coturn_git_pull_results
|
||||
when: "matrix_coturn_enabled|bool and matrix_coturn_container_image_self_build"
|
||||
|
||||
- name: Ensure Coturn Docker image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_coturn_docker_image }}"
|
||||
source: build
|
||||
force_source: "{{ matrix_coturn_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_coturn_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_coturn_enabled|bool and matrix_coturn_container_image_self_build"
|
||||
when: "matrix_coturn_enabled|bool and matrix_coturn_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure Coturn configuration path exists
|
||||
file:
|
||||
|
@ -5,6 +5,7 @@ Description=Matrix Coturn server
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
@ -30,7 +31,7 @@ ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-coturn \
|
||||
{% if matrix_coturn_container_turn_range_listen_interface is not none %}
|
||||
-p {{ matrix_coturn_container_turn_range_listen_interface }}{{ ':' if matrix_coturn_container_turn_range_listen_interface else '' }}{{ matrix_coturn_turn_udp_min_port }}-{{ matrix_coturn_turn_udp_max_port }}:{{ matrix_coturn_turn_udp_min_port }}-{{ matrix_coturn_turn_udp_max_port }}/udp \
|
||||
{% endif %}
|
||||
-v {{ matrix_coturn_config_path }}:/turnserver.conf:ro \
|
||||
--mount type=bind,src={{ matrix_coturn_config_path }},dst=/turnserver.conf,ro \
|
||||
{% for volume in matrix_coturn_container_additional_volumes %}
|
||||
-v {{ volume.src }}:{{ volume.dst }}:{{ volume.options }} \
|
||||
{% endfor %}
|
||||
|
@ -12,9 +12,15 @@ matrix_dimension_widgets_allow_self_signed_ssl_certificates: false
|
||||
|
||||
matrix_dimension_base_path: "{{ matrix_base_data_path }}/dimension"
|
||||
|
||||
matrix_dimension_docker_image: "turt2live/matrix-dimension:latest"
|
||||
matrix_dimension_docker_image: "docker.io/turt2live/matrix-dimension:latest"
|
||||
matrix_dimension_docker_image_force_pull: "{{ matrix_dimension_docker_image.endswith(':latest') }}"
|
||||
|
||||
# List of systemd services that matrix-dimension.service depends on.
|
||||
matrix_dimension_systemd_required_services_list: ['docker.service']
|
||||
|
||||
# List of systemd services that matrix-dimension.service wants
|
||||
matrix_dimension_systemd_wanted_services_list: []
|
||||
|
||||
# The user and group id correspond to the node user in the `turt2live/matrix-dimension` image.
|
||||
matrix_dimension_user_uid: '1000'
|
||||
matrix_dimension_user_gid: '1000'
|
||||
@ -34,6 +40,28 @@ matrix_dimension_integrations_jitsi_widget_url: "https://{{ matrix_server_fqn_di
|
||||
|
||||
matrix_dimension_homeserver_federationUrl: "http://matrix-synapse:8048"
|
||||
|
||||
|
||||
# Database-related configuration fields.
|
||||
#
|
||||
# To use SQLite, stick to these defaults.
|
||||
#
|
||||
# To use Postgres:
|
||||
# - change the engine (`matrix_dimension_database_engine: 'postgres'`)
|
||||
# - adjust your database credentials via the `matrix_dimension_postgres_*` variables
|
||||
matrix_dimension_database_engine: 'sqlite'
|
||||
|
||||
matrix_dimension_sqlite_database_path_local: "{{ matrix_dimension_base_path }}/dimension.db"
|
||||
matrix_dimension_sqlite_database_path_in_container: "dimension.db"
|
||||
|
||||
matrix_dimension_database_username: 'matrix_dimension'
|
||||
matrix_dimension_database_password: 'some-password'
|
||||
matrix_dimension_database_hostname: 'matrix-postgres'
|
||||
matrix_dimension_database_port: 5432
|
||||
matrix_dimension_database_name: 'matrix_dimension'
|
||||
|
||||
matrix_dimension_database_connection_string: 'postgres://{{ matrix_dimension_database_username }}:{{ matrix_dimension_database_password }}@{{ matrix_dimension_database_hostname }}:{{ matrix_dimension_database_port }}/{{ matrix_dimension_database_name }}'
|
||||
|
||||
|
||||
# Default Dimension configuration template which covers the generic use case.
|
||||
# You can customize it by controlling the various variables inside it.
|
||||
#
|
||||
|
@ -8,8 +8,14 @@
|
||||
- setup-all
|
||||
- setup-dimension
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/setup_dimension.yml"
|
||||
when: run_setup|bool
|
||||
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||
when: run_setup|bool and matrix_dimension_enabled|bool
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-dimension
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||
when: run_setup|bool and not matrix_dimension_enabled|bool
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-dimension
|
||||
|
@ -1,85 +0,0 @@
|
||||
---
|
||||
|
||||
#
|
||||
# Tasks related to setting up the dimension
|
||||
#
|
||||
|
||||
- name: Ensure Dimension base path exists
|
||||
file:
|
||||
path: "{{ matrix_dimension_base_path }}"
|
||||
state: directory
|
||||
mode: 0770
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_dimension_user_gid }}"
|
||||
when: matrix_dimension_enabled|bool
|
||||
|
||||
- name: Ensure Dimension config installed
|
||||
copy:
|
||||
content: "{{ matrix_dimension_configuration|to_nice_yaml }}"
|
||||
dest: "{{ matrix_dimension_base_path }}/config.yaml"
|
||||
mode: 0640
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_dimension_user_gid }}"
|
||||
when: matrix_dimension_enabled|bool
|
||||
|
||||
- name: Ensure Dimension image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_dimension_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_dimension_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_dimension_docker_image_force_pull }}"
|
||||
when: matrix_dimension_enabled|bool
|
||||
|
||||
- name: Ensure matrix-dimension.service installed
|
||||
template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-dimension.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/matrix-dimension.service"
|
||||
mode: 0644
|
||||
register: matrix_dimension_systemd_service_result
|
||||
when: matrix_dimension_enabled|bool
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-dimension.service installation
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_dimension_enabled|bool and matrix_dimension_systemd_service_result.changed"
|
||||
|
||||
#
|
||||
# Tasks related to getting rid of the dimension (if it was previously enabled)
|
||||
#
|
||||
|
||||
- name: Check existence of matrix-dimension service
|
||||
stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-dimension.service"
|
||||
register: matrix_dimension_service_stat
|
||||
when: "not matrix_dimension_enabled|bool"
|
||||
|
||||
- name: Ensure matrix-dimension is stopped
|
||||
service:
|
||||
name: matrix-dimension
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
register: stopping_result
|
||||
when: "not matrix_dimension_enabled|bool and matrix_dimension_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-dimension.service doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-dimension.service"
|
||||
state: absent
|
||||
when: "not matrix_dimension_enabled|bool and matrix_dimension_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-dimension.service removal
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "not matrix_dimension_enabled|bool and matrix_dimension_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure Dimension environment variables path doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_dimension_base_path }}"
|
||||
state: absent
|
||||
when: "not matrix_dimension_enabled|bool"
|
||||
|
||||
- name: Ensure Dimension Docker image doesn't exist
|
||||
docker_image:
|
||||
name: "{{ matrix_dimension_docker_image }}"
|
||||
state: absent
|
||||
when: "not matrix_dimension_enabled|bool"
|
109
roles/matrix-dimension/tasks/setup_install.yml
Normal file
109
roles/matrix-dimension/tasks/setup_install.yml
Normal file
@ -0,0 +1,109 @@
|
||||
---
|
||||
|
||||
- set_fact:
|
||||
matrix_dimension_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_dimension_sqlite_database_path_local }}"
|
||||
register: matrix_dimension_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
# pgloader makes a few columns `smallint`, instead of `boolean`.
|
||||
# We need to fix them up.
|
||||
- set_fact:
|
||||
matrix_dimension_pgloader_additional_psql_statements_list: []
|
||||
|
||||
- set_fact:
|
||||
matrix_dimension_pgloader_additional_psql_statements_list: |
|
||||
{{
|
||||
matrix_dimension_pgloader_additional_psql_statements_list
|
||||
+
|
||||
([] if item.default == '' else ['ALTER TABLE ' + item.table + ' ALTER COLUMN "' + item.column + '" DROP default;'])
|
||||
+
|
||||
(['ALTER TABLE ' + item.table + ' ALTER COLUMN "' + item.column + '" TYPE BOOLEAN USING("' + item.column + '"::text::boolean);'])
|
||||
+
|
||||
([] if item.default == '' else ['ALTER TABLE ' + item.table + ' ALTER COLUMN "' + item.column + '" SET default ' + item.default + ';'])
|
||||
}}
|
||||
with_items:
|
||||
- {'table': 'dimension_widgets', 'column': 'isEnabled', 'default': ''}
|
||||
- {'table': 'dimension_widgets', 'column': 'isPublic', 'default': ''}
|
||||
- {'table': 'dimension_webhook_bridges', 'column': 'isEnabled', 'default': ''}
|
||||
- {'table': 'dimension_user_sticker_packs', 'column': 'isSelected', 'default': ''}
|
||||
- {'table': 'dimension_scalar_tokens', 'column': 'isDimensionToken', 'default': ''}
|
||||
- {'table': 'dimension_users', 'column': 'isSelfBot', 'default': 'false'}
|
||||
- {'table': 'dimension_telegram_bridges', 'column': 'allowTgPuppets', 'default': ''}
|
||||
- {'table': 'dimension_telegram_bridges', 'column': 'allowMxPuppets', 'default': ''}
|
||||
- {'table': 'dimension_telegram_bridges', 'column': 'isEnabled', 'default': ''}
|
||||
- {'table': 'dimension_sticker_packs', 'column': 'isEnabled', 'default': ''}
|
||||
- {'table': 'dimension_sticker_packs', 'column': 'isPublic', 'default': ''}
|
||||
- {'table': 'dimension_slack_bridges', 'column': 'isEnabled', 'default': ''}
|
||||
- {'table': 'dimension_neb_integrations', 'column': 'isPublic', 'default': ''}
|
||||
- {'table': 'dimension_irc_bridges', 'column': 'isEnabled', 'default': ''}
|
||||
- {'table': 'dimension_irc_bridge_networks', 'column': 'isEnabled', 'default': ''}
|
||||
- {'table': 'dimension_gitter_bridges', 'column': 'isEnabled', 'default': ''}
|
||||
- {'table': 'dimension_custom_simple_bots', 'column': 'isEnabled', 'default': ''}
|
||||
- {'table': 'dimension_custom_simple_bots', 'column': 'isPublic', 'default': ''}
|
||||
- {'table': 'dimension_bridges', 'column': 'isEnabled', 'default': ''}
|
||||
- {'table': 'dimension_bridges', 'column': 'isPublic', 'default': ''}
|
||||
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_dimension_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_dimension_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_dimension_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-dimension.service']
|
||||
pgloader_options: ['--with "quote identifiers"']
|
||||
additional_psql_statements_list: "{{ matrix_dimension_pgloader_additional_psql_statements_list }}"
|
||||
additional_psql_statements_db_name: "{{ matrix_dimension_database_name }}"
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_dimension_requires_restart: true
|
||||
when: "matrix_dimension_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_dimension_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure Dimension base path exists
|
||||
file:
|
||||
path: "{{ matrix_dimension_base_path }}"
|
||||
state: directory
|
||||
mode: 0770
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_dimension_user_gid }}"
|
||||
|
||||
- name: Ensure Dimension config installed
|
||||
copy:
|
||||
content: "{{ matrix_dimension_configuration|to_nice_yaml }}"
|
||||
dest: "{{ matrix_dimension_base_path }}/config.yaml"
|
||||
mode: 0640
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_dimension_user_gid }}"
|
||||
|
||||
- name: Ensure Dimension image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_dimension_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_dimension_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_dimension_docker_image_force_pull }}"
|
||||
|
||||
- name: Ensure matrix-dimension.service installed
|
||||
template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-dimension.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/matrix-dimension.service"
|
||||
mode: 0644
|
||||
register: matrix_dimension_systemd_service_result
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-dimension.service installation
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_dimension_systemd_service_result.changed|bool"
|
||||
|
||||
- name: Ensure matrix-dimension.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-dimension.service"
|
||||
state: restarted
|
||||
when: "matrix_dimension_requires_restart|bool"
|
35
roles/matrix-dimension/tasks/setup_uninstall.yml
Normal file
35
roles/matrix-dimension/tasks/setup_uninstall.yml
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
|
||||
- name: Check existence of matrix-dimension service
|
||||
stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-dimension.service"
|
||||
register: matrix_dimension_service_stat
|
||||
|
||||
- name: Ensure matrix-dimension is stopped
|
||||
service:
|
||||
name: matrix-dimension
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
register: stopping_result
|
||||
when: "matrix_dimension_service_stat.stat.exists|bool"
|
||||
|
||||
- name: Ensure matrix-dimension.service doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-dimension.service"
|
||||
state: absent
|
||||
when: "matrix_dimension_service_stat.stat.exists|bool"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-dimension.service removal
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_dimension_service_stat.stat.exists|bool"
|
||||
|
||||
- name: Ensure Dimension base directory doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_dimension_base_path }}"
|
||||
state: absent
|
||||
|
||||
- name: Ensure Dimension Docker image doesn't exist
|
||||
docker_image:
|
||||
name: "{{ matrix_dimension_docker_image }}"
|
||||
state: absent
|
@ -44,7 +44,11 @@ widgetBlacklist:
|
||||
|
||||
# Where the database for Dimension is
|
||||
database:
|
||||
file: "dimension.db"
|
||||
{% if matrix_dimension_database_engine == 'sqlite' %}
|
||||
file: {{ matrix_dimension_sqlite_database_path_in_container|to_json }}
|
||||
{% elif matrix_dimension_database_engine == 'postgres' %}
|
||||
uri: {{ matrix_dimension_database_connection_string|to_json }}
|
||||
{% endif %}
|
||||
|
||||
# Display settings that apply to self-hosted go-neb instances
|
||||
goneb:
|
||||
|
@ -1,8 +1,14 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=Matrix Dimension
|
||||
After=docker.service
|
||||
Requires=docker.service
|
||||
{% for service in matrix_dimension_systemd_required_services_list %}
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
{% for service in matrix_dimension_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
@ -10,7 +16,9 @@ ExecStartPre=-{{ matrix_host_command_docker }} kill matrix-dimension
|
||||
ExecStartPre=-{{ matrix_host_command_docker }} rm matrix-dimension
|
||||
|
||||
# Fixup database ownership if it got changed somehow (during a server migration, etc.)
|
||||
ExecStartPre=-{{ matrix_host_command_chown }} {{ matrix_dimension_user_uid }}:{{ matrix_dimension_user_gid }} {{ matrix_dimension_base_path }}/dimension.db
|
||||
{% if matrix_dimension_database_engine == 'sqlite' %}
|
||||
ExecStartPre=-{{ matrix_host_command_chown }} {{ matrix_dimension_user_uid }}:{{ matrix_dimension_user_gid }} {{ matrix_dimension_sqlite_database_path_local }}
|
||||
{% endif %}
|
||||
|
||||
ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-dimension \
|
||||
--log-driver=none \
|
||||
@ -23,7 +31,7 @@ ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-dimension \
|
||||
{% if matrix_dimension_container_http_host_bind_port %}
|
||||
-p {{ matrix_dimension_container_http_host_bind_port }}:8184 \
|
||||
{% endif %}
|
||||
-v {{ matrix_dimension_base_path }}:/data:rw \
|
||||
--mount type=bind,src={{ matrix_dimension_base_path }},dst=/data \
|
||||
{% for arg in matrix_dimension_container_extra_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
|
46
roles/matrix-dynamic-dns/defaults/main.yml
Normal file
46
roles/matrix-dynamic-dns/defaults/main.yml
Normal file
@ -0,0 +1,46 @@
|
||||
# Whether dynamic dns is enabled
|
||||
matrix_dynamic_dns_enabled: true
|
||||
|
||||
# The dynamic dns daemon interval
|
||||
matrix_dynamic_dns_daemon_interval: '300'
|
||||
|
||||
# The docker container to use when in mode
|
||||
matrix_dynamic_dns_docker_image: '{{ matrix_dynamic_dns_docker_image_name_prefix }}linuxserver/ddclient:v3.9.1-ls45'
|
||||
|
||||
matrix_dynamic_dns_docker_image_name_prefix: "{{ 'localhost/' if matrix_dynamic_dns_container_image_self_build else 'docker.io/' }}"
|
||||
|
||||
# The image to force pull
|
||||
matrix_dynamic_dns_docker_image_force_pull: "{{ matrix_dynamic_dns_docker_image.endswith(':latest') }}"
|
||||
|
||||
# List of extra arguments to pass to the ontainer mode
|
||||
matrix_dynamic_dns_container_extra_arguments: []
|
||||
|
||||
# List of wanted services when running in mode
|
||||
matrix_dynamic_dns_systemd_wanted_services_list: []
|
||||
|
||||
# List of required services when running in mode
|
||||
matrix_dynamic_dns_systemd_required_services_list: ['docker.service']
|
||||
|
||||
# Build the container from source when running in mode
|
||||
matrix_dynamic_dns_container_image_self_build: false
|
||||
matrix_dynamic_dns_container_image_self_build_repo: "https://github.com/linuxserver/docker-ddclient.git"
|
||||
|
||||
# Config paths
|
||||
matrix_dynamic_dns_base_path: "{{ matrix_base_data_path }}/dynamic-dns"
|
||||
matrix_dynamic_dns_config_path: "{{ matrix_dynamic_dns_base_path }}/config"
|
||||
matrix_dynamic_dns_docker_src_files_path: "{{ matrix_dynamic_dns_base_path }}/docker-src"
|
||||
|
||||
# Holds the configurations (the domains to update DNS for, the providers they use, etc.)
|
||||
#
|
||||
# Example:
|
||||
# matrix_dynamic_dns_domain_configurations:
|
||||
# - provider: domains.google.com
|
||||
# protocol: dyndn2
|
||||
# username: XXXXXXXXXXXXXXXX
|
||||
# password: XXXXXXXXXXXXXXXX
|
||||
# domain: "{{ matrix_domain }}"
|
||||
matrix_dynamic_dns_domain_configurations: []
|
||||
|
||||
# Config options
|
||||
matrix_dynamic_dns_additional_configuration_blocks: []
|
||||
matrix_dynamic_dns_use: "web"
|
3
roles/matrix-dynamic-dns/tasks/init.yml
Normal file
3
roles/matrix-dynamic-dns/tasks/init.yml
Normal file
@ -0,0 +1,3 @@
|
||||
- set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-dynamic-dns'] }}"
|
||||
when: "matrix_dynamic_dns_enabled|bool"
|
61
roles/matrix-dynamic-dns/tasks/install.yml
Normal file
61
roles/matrix-dynamic-dns/tasks/install.yml
Normal file
@ -0,0 +1,61 @@
|
||||
---
|
||||
|
||||
- name: Ensure Dynamic DNS image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_dynamic_dns_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_dynamic_dns_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_dynamic_dns_docker_image_force_pull }}"
|
||||
when: matrix_dynamic_dns_enabled|bool and not matrix_dynamic_dns_container_image_self_build
|
||||
|
||||
- name: Ensure Dynamic DNS paths exist
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
mode: 0751
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- { path: "{{ matrix_dynamic_dns_base_path }}", when: true }
|
||||
- { path: "{{ matrix_dynamic_dns_config_path }}", when: true }
|
||||
- { path: "{{ matrix_dynamic_dns_docker_src_files_path }}", when: "{{ matrix_dynamic_dns_container_image_self_build }}" }
|
||||
when: matrix_dynamic_dns_enabled|bool and item.when|bool
|
||||
|
||||
- name: Ensure Dynamic DNS repository is present on self build
|
||||
git:
|
||||
repo: "{{ matrix_dynamic_dns_container_image_self_build_repo }}"
|
||||
dest: "{{ matrix_dynamic_dns_docker_src_files_path }}"
|
||||
force: "yes"
|
||||
register: matrix_dynamic_dns_git_pull_results
|
||||
when: "matrix_dynamic_dns_enabled|bool and matrix_dynamic_dns_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure Dynamic DNS Docker image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_dynamic_dns_docker_image }}"
|
||||
source: build
|
||||
force_source: "{{ matrix_dynamic_dns_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_dynamic_dns_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_dynamic_dns_enabled|bool and matrix_dynamic_dns_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure Dynamic DNS ddclient.conf installed
|
||||
template:
|
||||
src: "{{ role_path }}/templates/ddclient.conf.j2"
|
||||
dest: "{{ matrix_dynamic_dns_config_path }}/ddclient.conf"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
- name: Ensure matrix-dynamic-dns.service installed
|
||||
template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-dynamic-dns.service.j2"
|
||||
dest: "/etc/systemd/system/matrix-dynamic-dns.service"
|
||||
mode: 0644
|
||||
register: matrix_dynamic_dns_systemd_service_result
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-dynamic-dns.service installation
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_dynamic_dns_systemd_service_result.changed"
|
21
roles/matrix-dynamic-dns/tasks/main.yml
Normal file
21
roles/matrix-dynamic-dns/tasks/main.yml
Normal file
@ -0,0 +1,21 @@
|
||||
- import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||
when: "run_setup|bool and matrix_dynamic_dns_enabled|bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-dynamic-dns
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/install.yml"
|
||||
when: "run_setup|bool and matrix_dynamic_dns_enabled|bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-dynamic-dns
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/uninstall.yml"
|
||||
when: "run_setup|bool and not matrix_dynamic_dns_enabled|bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-dynamic-dns
|
24
roles/matrix-dynamic-dns/tasks/uninstall.yml
Normal file
24
roles/matrix-dynamic-dns/tasks/uninstall.yml
Normal file
@ -0,0 +1,24 @@
|
||||
---
|
||||
|
||||
- name: Check existence of matrix-dynamic-dns service
|
||||
stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-dynamic-dns.service"
|
||||
register: matrix_dynamic_dns_service_stat
|
||||
|
||||
- name: Ensure matrix-dynamic-dns is stopped
|
||||
service:
|
||||
name: matrix-dynamic-dns
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
when: "matrix_dynamic_dns_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-dynamic-dns.service doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-dynamic-dns.service"
|
||||
state: absent
|
||||
when: "matrix_dynamic_dns_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-dynamic-dns.service removal
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_dynamic_dns_service_stat.stat.exists"
|
16
roles/matrix-dynamic-dns/tasks/validate_config.yml
Normal file
16
roles/matrix-dynamic-dns/tasks/validate_config.yml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
|
||||
- name: Fail if no configurations specified
|
||||
fail:
|
||||
msg: >-
|
||||
You need to define at least one configuration in `matrix_dynamic_dns_domain_configurations` for using matrix-dynamic-dns.
|
||||
when: "matrix_dynamic_dns_domain_configurations|length == 0"
|
||||
|
||||
- name: Fail if required settings not defined in configuration blocks
|
||||
fail:
|
||||
msg: >-
|
||||
One of the configurations in matrix_dynamic_dns_domain_configurations is missing a required key (domain, provider, protocol).
|
||||
when: "'domain' not in configuration or 'provider' not in configuration or 'protocol' not in configuration"
|
||||
with_items: "{{ matrix_dynamic_dns_domain_configurations }}"
|
||||
loop_control:
|
||||
loop_var: configuration
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user