|
|
|
@ -14,8 +14,10 @@
|
|
|
|
|
group: "{{ matrix_user_username }}"
|
|
|
|
|
when: "matrix_mautrix_whatsapp_enabled"
|
|
|
|
|
|
|
|
|
|
- stat: "path={{ matrix_mautrix_whatsapp_base_path }}/config.yaml"
|
|
|
|
|
register: mautrix_config_file
|
|
|
|
|
- name: Check if a mautrix-whatsapp configuration file exists
|
|
|
|
|
stat:
|
|
|
|
|
path: "{{ matrix_mautrix_whatsapp_base_path }}/config.yaml"
|
|
|
|
|
register: mautrix_whatsapp_config_file_stat
|
|
|
|
|
|
|
|
|
|
- name: Ensure Matrix Mautrix whatsapp config installed
|
|
|
|
|
template:
|
|
|
|
@ -24,7 +26,7 @@
|
|
|
|
|
mode: 0644
|
|
|
|
|
owner: "{{ matrix_user_username }}"
|
|
|
|
|
group: "{{ matrix_user_username }}"
|
|
|
|
|
when: "matrix_mautrix_whatsapp_enabled and mautrix_config_file.stat.exists == False"
|
|
|
|
|
when: "matrix_mautrix_whatsapp_enabled and not mautrix_whatsapp_config_file_stat.stat.exists"
|
|
|
|
|
|
|
|
|
|
- name: Ensure matrix-mautrix-whatsapp.service installed
|
|
|
|
|
template:
|
|
|
|
@ -33,13 +35,23 @@
|
|
|
|
|
mode: 0644
|
|
|
|
|
when: "matrix_mautrix_whatsapp_enabled"
|
|
|
|
|
|
|
|
|
|
- stat:
|
|
|
|
|
- name: Check if a mautrix-whatsapp registration file exists
|
|
|
|
|
stat:
|
|
|
|
|
path: "{{ matrix_mautrix_whatsapp_base_path }}/registration.yaml"
|
|
|
|
|
register: mautrix_whatsapp_registration_file
|
|
|
|
|
register: mautrix_whatsapp_registration_file_stat
|
|
|
|
|
|
|
|
|
|
- name: Generate matrix-mautrix-whatsapp registration.yaml if it doesn't exist
|
|
|
|
|
shell: /usr/bin/docker run --rm --name matrix-mautrix-whatsapp-gen -v {{ matrix_mautrix_whatsapp_base_path }}:/data:z {{ matrix_mautrix_whatsapp_docker_image }} /usr/bin/mautrix-whatsapp -g -c /data/config.yaml -r /data/registration.yaml
|
|
|
|
|
when: "matrix_mautrix_whatsapp_enabled and mautrix_whatsapp_registration_file.stat.exists == False"
|
|
|
|
|
shell:
|
|
|
|
|
cmd: >-
|
|
|
|
|
/usr/bin/docker run
|
|
|
|
|
--rm
|
|
|
|
|
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
|
|
|
|
|
--cap-drop=ALL
|
|
|
|
|
--name matrix-mautrix-whatsapp-gen
|
|
|
|
|
-v {{ matrix_mautrix_whatsapp_base_path }}:/data:z
|
|
|
|
|
{{ matrix_mautrix_whatsapp_docker_image }}
|
|
|
|
|
/usr/bin/mautrix-whatsapp -g -c /data/config.yaml -r /data/registration.yaml
|
|
|
|
|
when: "matrix_mautrix_whatsapp_enabled and not mautrix_whatsapp_registration_file_stat.stat.exists"
|
|
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
|
matrix_synapse_app_service_config_file_mautrix_whatsapp: '/app-registration/mautrix-whatsapp.yml'
|
|
|
|
|