2021-03-20 19:31:34 +08:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Ensure Sygnal image is pulled
|
2022-10-28 19:20:17 +08:00
|
|
|
community.docker.docker_image:
|
2021-03-20 19:31:34 +08:00
|
|
|
name: "{{ matrix_sygnal_docker_image }}"
|
|
|
|
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
|
|
|
force_source: "{{ matrix_sygnal_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_sygnal_docker_image_force_pull }}"
|
2022-03-17 23:37:11 +08:00
|
|
|
register: result
|
|
|
|
retries: "{{ matrix_container_retries_count }}"
|
|
|
|
delay: "{{ matrix_container_retries_delay }}"
|
|
|
|
until: result is not failed
|
2021-03-20 19:31:34 +08:00
|
|
|
|
|
|
|
- name: Ensure Sygnal paths exists
|
2022-07-18 15:39:08 +08:00
|
|
|
ansible.builtin.file:
|
2021-03-20 19:31:34 +08:00
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
mode: 0750
|
|
|
|
owner: "{{ matrix_user_username }}"
|
|
|
|
group: "{{ matrix_user_groupname }}"
|
|
|
|
with_items:
|
|
|
|
- "{{ matrix_sygnal_base_path }}"
|
|
|
|
- "{{ matrix_sygnal_config_path }}"
|
|
|
|
- "{{ matrix_sygnal_data_path }}"
|
|
|
|
|
|
|
|
- name: Ensure Sygnal config installed
|
2022-07-18 15:39:08 +08:00
|
|
|
ansible.builtin.copy:
|
2022-07-18 16:22:05 +08:00
|
|
|
content: "{{ matrix_sygnal_configuration | to_nice_yaml(indent=2, width=999999) }}"
|
2021-03-20 19:31:34 +08:00
|
|
|
dest: "{{ matrix_sygnal_config_path }}/sygnal.yaml"
|
|
|
|
mode: 0640
|
|
|
|
owner: "{{ matrix_user_username }}"
|
|
|
|
group: "{{ matrix_user_groupname }}"
|
|
|
|
|
|
|
|
- name: Ensure matrix-sygnal.service installed
|
2022-07-18 15:39:08 +08:00
|
|
|
ansible.builtin.template:
|
2021-03-20 19:31:34 +08:00
|
|
|
src: "{{ role_path }}/templates/systemd/matrix-sygnal.service.j2"
|
|
|
|
dest: "{{ matrix_systemd_path }}/matrix-sygnal.service"
|
|
|
|
mode: 0644
|
|
|
|
register: matrix_sygnal_systemd_service_result
|
|
|
|
|
|
|
|
- name: Ensure systemd reloaded after matrix-sygnal.service installation
|
2022-07-18 15:39:08 +08:00
|
|
|
ansible.builtin.service:
|
2022-02-06 04:32:54 +08:00
|
|
|
daemon_reload: true
|
2022-07-18 16:22:05 +08:00
|
|
|
when: "matrix_sygnal_systemd_service_result.changed | bool"
|