Compare commits
21 Commits
7fe5d611d5
...
c635181990
Author | SHA1 | Date | |
---|---|---|---|
c635181990 | |||
47cf179ef4 | |||
95cbdc8be4 | |||
|
24b89f8288 | ||
|
24589b91f4 | ||
|
6de8b5925a | ||
|
f54f2827c4 | ||
|
6ecfbe98b1 | ||
|
d11d6f52ae | ||
|
f9bc5e2cb6 | ||
|
d2a1b8b134 | ||
|
2e23166ed3 | ||
|
f3aae70f70 | ||
|
23006fd64e | ||
|
421f85defa | ||
|
2697590d28 | ||
|
a68ac9cb4f | ||
|
5fc61ed964 | ||
|
5575ad8117 | ||
|
519eef9e4b | ||
|
dca876a8f0 |
@ -82,8 +82,8 @@ Based on your setup, you have different ways to go about it:
|
||||
#
|
||||
# NOTE: these are in-container paths. `/matrix/ssl` on the host is mounted into the container
|
||||
# at the same path (`/matrix/ssl`) by default, so if that's the path you need, it would be seamless.
|
||||
matrix_nginx_proxy_proxy_matrix_federation_api_ssl_certificate: /matrix/ssl/config/live/matrix.<your-domain>/fullchain.pem
|
||||
matrix_nginx_proxy_proxy_matrix_federation_api_ssl_certificate_key: /matrix/ssl/config/live/matrix.<your-domain>/privkey.pem
|
||||
matrix_nginx_proxy_proxy_matrix_federation_api_ssl_certificate: /matrix/ssl/config/live/<your-domain>/fullchain.pem
|
||||
matrix_nginx_proxy_proxy_matrix_federation_api_ssl_certificate_key: /matrix/ssl/config/live/<your-domain>/privkey.pem
|
||||
```
|
||||
|
||||
If your files are not in `/matrix/ssl` but in some other location, you would need to mount them into the container:
|
||||
|
@ -23,7 +23,7 @@ To import, run this command (make sure to replace `<server-path-to-postgres-dump
|
||||
|
||||
```sh
|
||||
ansible-playbook -i inventory/hosts setup.yml \
|
||||
--extra-vars='postgres_default_import_database=synapse server_path_postgres_dump=<server-path-to-postgres-dump.sql>' \
|
||||
--extra-vars='server_path_postgres_dump=<server-path-to-postgres-dump.sql>' \
|
||||
--tags=import-postgres
|
||||
```
|
||||
|
||||
|
@ -29,6 +29,7 @@ List of roles where self-building the Docker image is currently possible:
|
||||
- `matrix-bridge-mx-puppet-skype`
|
||||
- `matrix-bot-mjolnir`
|
||||
- `matrix-bot-matrix-reminder-bot`
|
||||
- `matrix-email2matrix`
|
||||
|
||||
Adding self-building support to other roles is welcome. Feel free to contribute!
|
||||
|
||||
|
@ -1037,6 +1037,8 @@ matrix_dynamic_dns_enabled: false
|
||||
|
||||
matrix_email2matrix_enabled: false
|
||||
|
||||
matrix_email2matrix_container_image_self_build: "{{ matrix_architecture != 'amd64' }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-email2matrix
|
||||
|
@ -7,7 +7,7 @@ matrix_appservice_irc_container_self_build: false
|
||||
matrix_appservice_irc_docker_repo: "https://github.com/matrix-org/matrix-appservice-irc.git"
|
||||
matrix_appservice_irc_docker_src_files_path: "{{ matrix_base_data_path }}/appservice-irc/docker-src"
|
||||
|
||||
matrix_appservice_irc_version: release-0.27.0
|
||||
matrix_appservice_irc_version: release-v0.29.0
|
||||
matrix_appservice_irc_docker_image: "{{ matrix_container_global_registry_prefix }}matrixdotorg/matrix-appservice-irc:{{ matrix_appservice_irc_version }}"
|
||||
matrix_appservice_irc_docker_image_force_pull: "{{ matrix_appservice_irc_docker_image.endswith(':latest') }}"
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mautrix_facebook_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_mautrix_facebook_docker_image_force_pull }}"
|
||||
when: matrix_mautrix_facebook_enabled|bool and not matrix_mautrix_facebook_container_image_self_build
|
||||
when: not matrix_mautrix_facebook_container_image_self_build
|
||||
|
||||
- name: Ensure Mautrix Facebook paths exist
|
||||
file:
|
||||
@ -63,7 +63,7 @@
|
||||
# version: "{{ matrix_coturn_docker_image.split(':')[1] }}"
|
||||
force: "yes"
|
||||
register: matrix_mautrix_facebook_git_pull_results
|
||||
when: "matrix_mautrix_facebook_enabled|bool and matrix_mautrix_facebook_container_image_self_build"
|
||||
when: "matrix_mautrix_facebook_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure Mautrix Facebook Docker image is built
|
||||
docker_image:
|
||||
@ -75,7 +75,7 @@
|
||||
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|bool"
|
||||
when: "matrix_mautrix_facebook_container_image_self_build|bool"
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
|
@ -40,7 +40,7 @@
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mautrix_hangouts_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_mautrix_hangouts_docker_image_force_pull }}"
|
||||
when: matrix_mautrix_hangouts_enabled|bool and not matrix_mautrix_hangouts_container_image_self_build
|
||||
when: not matrix_mautrix_hangouts_container_image_self_build
|
||||
|
||||
- name: Ensure Mautrix Hangouts paths exist
|
||||
file:
|
||||
@ -54,7 +54,7 @@
|
||||
- { path: "{{ matrix_mautrix_hangouts_config_path }}", when: true }
|
||||
- { path: "{{ matrix_mautrix_hangouts_data_path }}", when: true }
|
||||
- { path: "{{ matrix_mautrix_hangouts_docker_src_files_path }}", when: "{{ matrix_mautrix_hangouts_container_image_self_build }}" }
|
||||
when: matrix_mautrix_hangouts_enabled|bool and item.when|bool
|
||||
when: "item.when|bool"
|
||||
|
||||
- name: Ensure Mautrix Hangots repository is present on self build
|
||||
git:
|
||||
@ -62,7 +62,7 @@
|
||||
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|bool"
|
||||
when: "matrix_mautrix_hangouts_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure Mautrix Hangouts Docker image is built
|
||||
docker_image:
|
||||
@ -74,7 +74,7 @@
|
||||
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|bool"
|
||||
when: "matrix_mautrix_hangouts_container_image_self_build|bool"
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
|
@ -13,7 +13,7 @@
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mautrix_instagram_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_mautrix_instagram_docker_image_force_pull }}"
|
||||
when: matrix_mautrix_instagram_enabled|bool and not matrix_mautrix_instagram_container_image_self_build
|
||||
when: not matrix_mautrix_instagram_container_image_self_build
|
||||
|
||||
- name: Ensure Mautrix instagram paths exist
|
||||
file:
|
||||
@ -38,7 +38,7 @@
|
||||
dest: "{{ matrix_mautrix_instagram_docker_src_files_path }}"
|
||||
force: "yes"
|
||||
register: matrix_mautrix_instagram_git_pull_results
|
||||
when: "matrix_mautrix_instagram_enabled|bool and matrix_mautrix_instagram_container_image_self_build"
|
||||
when: "matrix_mautrix_instagram_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure Mautrix instagram Docker image is built
|
||||
docker_image:
|
||||
@ -50,7 +50,7 @@
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_mautrix_instagram_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_mautrix_instagram_enabled|bool and matrix_mautrix_instagram_container_image_self_build|bool"
|
||||
when: "matrix_mautrix_instagram_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure mautrix-instagram config.yaml installed
|
||||
copy:
|
||||
|
@ -1,16 +1,16 @@
|
||||
# mautrix-signal is a Matrix <-> Signal bridge
|
||||
# See: https://github.com/tulir/mautrix-signal
|
||||
# See: https://github.com/mautrix/signal
|
||||
|
||||
matrix_mautrix_signal_enabled: true
|
||||
|
||||
matrix_mautrix_signal_container_self_build: false
|
||||
matrix_mautrix_signal_docker_repo: "https://mau.dev/tulir/mautrix-signal.git"
|
||||
matrix_mautrix_signal_docker_repo: "https://mau.dev/mautrix/signal.git"
|
||||
matrix_mautrix_signal_docker_src_files_path: "{{ matrix_base_data_path }}/mautrix-signal/docker-src"
|
||||
|
||||
matrix_mautrix_signal_version: latest
|
||||
matrix_mautrix_signal_daemon_version: latest
|
||||
# See: https://mau.dev/tulir/mautrix-signal/container_registry
|
||||
matrix_mautrix_signal_docker_image: "dock.mau.dev/tulir/mautrix-signal:{{ matrix_mautrix_signal_version }}"
|
||||
# See: https://mau.dev/mautrix/signal/container_registry
|
||||
matrix_mautrix_signal_docker_image: "dock.mau.dev/mautrix/signal:{{ matrix_mautrix_signal_version }}"
|
||||
matrix_mautrix_signal_docker_image_force_pull: "{{ matrix_mautrix_signal_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_mautrix_signal_daemon_container_self_build: false
|
||||
|
@ -14,7 +14,7 @@
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mautrix_signal_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_mautrix_signal_docker_image_force_pull }}"
|
||||
when: "matrix_mautrix_signal_enabled|bool and not matrix_mautrix_signal_container_self_build|bool"
|
||||
when: "not matrix_mautrix_signal_container_self_build|bool"
|
||||
|
||||
|
||||
- name: Ensure Mautrix Signal repository is present on self-build
|
||||
@ -23,7 +23,7 @@
|
||||
dest: "{{ matrix_mautrix_signal_docker_src_files_path }}"
|
||||
force: "yes"
|
||||
register: matrix_mautrix_signal_git_pull_results
|
||||
when: "matrix_mautrix_signal_enabled|bool and matrix_mautrix_signal_container_self_build|bool"
|
||||
when: "matrix_mautrix_signal_container_self_build|bool"
|
||||
|
||||
- name: Ensure Mautrix Signal image is built
|
||||
docker_image:
|
||||
@ -35,7 +35,7 @@
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_mautrix_signal_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_mautrix_signal_enabled|bool and matrix_mautrix_signal_container_self_build|bool"
|
||||
when: "matrix_mautrix_signal_container_self_build|bool"
|
||||
|
||||
|
||||
- name: Ensure Mautrix Signal Daemon image is pulled
|
||||
@ -53,7 +53,7 @@
|
||||
dest: "{{ matrix_mautrix_signal_daemon_docker_src_files_path }}"
|
||||
force: "yes"
|
||||
register: matrix_mautrix_signal_daemon_git_pull_results
|
||||
when: "matrix_mautrix_signal_enabled|bool and matrix_mautrix_signal_daemon_container_self_build|bool"
|
||||
when: "matrix_mautrix_signal_daemon_container_self_build|bool"
|
||||
|
||||
- name: Ensure Mautrix Signal Daemon image is built
|
||||
docker_image:
|
||||
@ -65,7 +65,7 @@
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_mautrix_signal_daemon_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_mautrix_signal_enabled|bool and matrix_mautrix_signal_daemon_container_self_build|bool"
|
||||
when: "matrix_mautrix_signal_daemon_container_self_build|bool"
|
||||
|
||||
- name: Ensure Mautrix Signal paths exist
|
||||
file:
|
||||
|
@ -5,7 +5,7 @@ matrix_mautrix_whatsapp_enabled: true
|
||||
|
||||
matrix_mautrix_whatsapp_version: latest
|
||||
# See: https://mau.dev/tulir/mautrix-whatsapp/container_registry
|
||||
matrix_mautrix_whatsapp_docker_image: "dock.mau.dev/tulir/mautrix-whatsapp:{{ matrix_mautrix_whatsapp_version }}"
|
||||
matrix_mautrix_whatsapp_docker_image: "dock.mau.dev/mautrix/whatsapp:{{ matrix_mautrix_whatsapp_version }}"
|
||||
matrix_mautrix_whatsapp_docker_image_force_pull: "{{ matrix_mautrix_whatsapp_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_mautrix_whatsapp_base_path: "{{ matrix_base_data_path }}/mautrix-whatsapp"
|
||||
|
@ -3,7 +3,7 @@ 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_version: v1.7.33
|
||||
matrix_client_element_version: v1.7.34
|
||||
matrix_client_element_docker_image: "{{ matrix_client_element_docker_image_name_prefix }}vectorim/element-web:{{ matrix_client_element_version }}"
|
||||
matrix_client_element_docker_image_name_prefix: "{{ 'localhost/' if matrix_client_element_container_image_self_build else matrix_container_global_registry_prefix }}"
|
||||
matrix_client_element_docker_image_force_pull: "{{ matrix_client_element_docker_image.endswith(':latest') }}"
|
||||
|
@ -5,7 +5,7 @@ matrix_client_hydrogen_enabled: true
|
||||
matrix_client_hydrogen_container_image_self_build: true
|
||||
matrix_client_hydrogen_container_image_self_build_repo: "https://github.com/vector-im/hydrogen-web.git"
|
||||
|
||||
matrix_client_hydrogen_version: v0.2.3
|
||||
matrix_client_hydrogen_version: v0.2.5
|
||||
matrix_client_hydrogen_docker_image: "{{ matrix_client_hydrogen_docker_image_name_prefix }}vectorim/hydrogen-web:{{ matrix_client_hydrogen_version }}"
|
||||
matrix_client_hydrogen_docker_image_name_prefix: "{{ 'localhost/' if matrix_client_hydrogen_container_image_self_build }}"
|
||||
matrix_client_hydrogen_docker_image_force_pull: "{{ matrix_client_hydrogen_docker_image.endswith(':latest') }}"
|
||||
|
@ -2,9 +2,15 @@ matrix_email2matrix_enabled: true
|
||||
|
||||
matrix_email2matrix_base_path: "{{ matrix_base_data_path }}/email2matrix"
|
||||
matrix_email2matrix_config_dir_path: "{{ matrix_email2matrix_base_path }}/config"
|
||||
matrix_email2matrix_docker_src_files_path: "{{ matrix_email2matrix_base_path }}/docker-src"
|
||||
|
||||
matrix_email2matrix_container_image_self_build: false
|
||||
matrix_email2matrix_container_image_self_build_repo: "https://github.com/devture/email2matrix.git"
|
||||
matrix_email2matrix_container_image_self_build_branch: "{{ matrix_email2matrix_version }}"
|
||||
|
||||
matrix_email2matrix_version: 1.0.1
|
||||
matrix_email2matrix_docker_image: "{{ matrix_container_global_registry_prefix }}devture/email2matrix:{{ matrix_email2matrix_version }}"
|
||||
matrix_email2matrix_docker_image_prefix: "{{ 'localhost/' if matrix_email2matrix_container_image_self_build else matrix_container_global_registry_prefix }}"
|
||||
matrix_email2matrix_docker_image: "{{ matrix_email2matrix_docker_image_prefix }}devture/email2matrix:{{ matrix_email2matrix_version }}"
|
||||
matrix_email2matrix_docker_image_force_pull: "{{ matrix_email2matrix_docker_image.endswith(':latest') }}"
|
||||
|
||||
# A list of extra arguments to pass to the container
|
||||
|
@ -8,8 +8,14 @@
|
||||
- setup-all
|
||||
- setup-email2matrix
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/setup_email2matrix.yml"
|
||||
when: run_setup|bool
|
||||
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||
when: "run_setup|bool and matrix_email2matrix_enabled|bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-email2matrix
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||
when: "run_setup|bool and not matrix_email2matrix_enabled|bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-email2matrix
|
||||
|
@ -1,88 +0,0 @@
|
||||
---
|
||||
|
||||
#
|
||||
# Tasks related to setting up Email2Matrix
|
||||
#
|
||||
|
||||
- name: Ensure Email2Matrix paths exist
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- "{{ matrix_email2matrix_base_path }}"
|
||||
- "{{ matrix_email2matrix_config_dir_path }}"
|
||||
when: matrix_email2matrix_enabled|bool
|
||||
|
||||
- name: Ensure Email2Matrix configuration file created
|
||||
template:
|
||||
src: "{{ role_path }}/templates/config.json.j2"
|
||||
dest: "{{ matrix_email2matrix_config_dir_path }}/config.json"
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
mode: 0640
|
||||
when: matrix_email2matrix_enabled|bool
|
||||
|
||||
- name: Ensure Email2Matrix image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_email2matrix_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_email2matrix_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_email2matrix_docker_image_force_pull }}"
|
||||
when: matrix_email2matrix_enabled|bool
|
||||
|
||||
- name: Ensure matrix-email2matrix.service installed
|
||||
template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-email2matrix.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/matrix-email2matrix.service"
|
||||
mode: 0644
|
||||
register: matrix_email2matrix_systemd_service_result
|
||||
when: matrix_email2matrix_enabled|bool
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-email2matrix.service installation
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_email2matrix_enabled|bool and matrix_email2matrix_systemd_service_result.changed"
|
||||
|
||||
#
|
||||
# Tasks related to getting rid of the Email2Matrix (if it was previously enabled)
|
||||
#
|
||||
|
||||
- name: Check existence of matrix-email2matrix service
|
||||
stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-email2matrix.service"
|
||||
register: matrix_email2matrix_service_stat
|
||||
when: "not matrix_email2matrix_enabled|bool"
|
||||
|
||||
- name: Ensure matrix-email2matrix is stopped
|
||||
service:
|
||||
name: matrix-email2matrix
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
register: stopping_result
|
||||
when: "not matrix_email2matrix_enabled|bool and matrix_email2matrix_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-email2matrix.service doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-email2matrix.service"
|
||||
state: absent
|
||||
when: "not matrix_email2matrix_enabled|bool and matrix_email2matrix_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-email2matrix.service removal
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "not matrix_email2matrix_enabled|bool and matrix_email2matrix_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure Email2Matrix data path doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_email2matrix_base_path }}"
|
||||
state: absent
|
||||
when: "not matrix_email2matrix_enabled|bool"
|
||||
|
||||
- name: Ensure Email2Matrix Docker image doesn't exist
|
||||
docker_image:
|
||||
name: "{{ matrix_email2matrix_docker_image }}"
|
||||
state: absent
|
||||
when: "not matrix_email2matrix_enabled|bool"
|
63
roles/matrix-email2matrix/tasks/setup_install.yml
Normal file
63
roles/matrix-email2matrix/tasks/setup_install.yml
Normal file
@ -0,0 +1,63 @@
|
||||
---
|
||||
|
||||
- name: Ensure Email2Matrix paths exist
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- { path: "{{ matrix_email2matrix_base_path }}", when: true }
|
||||
- { path: "{{ matrix_email2matrix_config_dir_path }}", when: true }
|
||||
- { path: "{{ matrix_email2matrix_docker_src_files_path }}", when: "{{ matrix_email2matrix_container_image_self_build }}"}
|
||||
when: "item.when|bool"
|
||||
|
||||
- name: Ensure Email2Matrix configuration file created
|
||||
template:
|
||||
src: "{{ role_path }}/templates/config.json.j2"
|
||||
dest: "{{ matrix_email2matrix_config_dir_path }}/config.json"
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
mode: 0640
|
||||
|
||||
- name: Ensure Email2Matrix image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_email2matrix_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_email2matrix_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_email2matrix_docker_image_force_pull }}"
|
||||
when: "not matrix_email2matrix_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure Email2Matrix repository is present on self-build
|
||||
git:
|
||||
repo: "{{ matrix_email2matrix_container_image_self_build_repo }}"
|
||||
dest: "{{ matrix_email2matrix_docker_src_files_path }}"
|
||||
version: "{{ matrix_email2matrix_container_image_self_build_branch }}"
|
||||
force: "yes"
|
||||
register: matrix_email2matrix_git_pull_results
|
||||
when: "matrix_email2matrix_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure Email2Matrix Docker image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_email2matrix_docker_image }}"
|
||||
source: build
|
||||
force_source: "{{ matrix_email2matrix_git_pull_results.changed 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_email2matrix_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: etc/docker/Dockerfile
|
||||
path: "{{ matrix_email2matrix_docker_src_files_path }}"
|
||||
pull: yes
|
||||
when: "matrix_email2matrix_container_image_self_build|bool"
|
||||
|
||||
- name: Ensure matrix-email2matrix.service installed
|
||||
template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-email2matrix.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/matrix-email2matrix.service"
|
||||
mode: 0644
|
||||
register: matrix_email2matrix_systemd_service_result
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-email2matrix.service installation
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_email2matrix_systemd_service_result.changed|bool"
|
35
roles/matrix-email2matrix/tasks/setup_uninstall.yml
Normal file
35
roles/matrix-email2matrix/tasks/setup_uninstall.yml
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
|
||||
- name: Check existence of matrix-email2matrix service
|
||||
stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-email2matrix.service"
|
||||
register: matrix_email2matrix_service_stat
|
||||
|
||||
- name: Ensure matrix-email2matrix is stopped
|
||||
service:
|
||||
name: matrix-email2matrix
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
register: stopping_result
|
||||
when: "matrix_email2matrix_service_stat.stat.exists|bool"
|
||||
|
||||
- name: Ensure matrix-email2matrix.service doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-email2matrix.service"
|
||||
state: absent
|
||||
when: "matrix_email2matrix_service_stat.stat.exists|bool"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-email2matrix.service removal
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_email2matrix_service_stat.stat.exists|bool"
|
||||
|
||||
- name: Ensure Email2Matrix data path doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_email2matrix_base_path }}"
|
||||
state: absent
|
||||
|
||||
- name: Ensure Email2Matrix Docker image doesn't exist
|
||||
docker_image:
|
||||
name: "{{ matrix_email2matrix_docker_image }}"
|
||||
state: absent
|
Loading…
Reference in New Issue
Block a user