2017-07-31 20:07:30 +00:00
|
|
|
---
|
|
|
|
|
2017-09-12 09:41:44 +00:00
|
|
|
#
|
|
|
|
# Tasks related to setting up riot-web
|
|
|
|
#
|
|
|
|
|
2018-08-07 12:08:46 +00:00
|
|
|
- name: Ensure Matrix riot-web path exists
|
2017-07-31 20:07:30 +00:00
|
|
|
file:
|
2018-09-17 05:24:35 +00:00
|
|
|
path: "{{ matrix_riot_web_data_path }}"
|
2017-07-31 20:07:30 +00:00
|
|
|
state: directory
|
|
|
|
mode: 0750
|
|
|
|
owner: "{{ matrix_user_username }}"
|
|
|
|
group: "{{ matrix_user_username }}"
|
2019-05-21 15:25:59 +00:00
|
|
|
when: matrix_riot_web_enabled|bool
|
2017-07-31 20:07:30 +00:00
|
|
|
|
|
|
|
- name: Ensure riot-web Docker image is pulled
|
|
|
|
docker_image:
|
2018-11-01 06:46:47 +00:00
|
|
|
name: "{{ matrix_riot_web_docker_image }}"
|
2019-05-21 15:29:12 +00:00
|
|
|
source: "pull"
|
2019-05-21 15:25:59 +00:00
|
|
|
when: matrix_riot_web_enabled|bool
|
2017-07-31 20:07:30 +00:00
|
|
|
|
2019-02-16 09:48:17 +00:00
|
|
|
- name: Ensure Matrix riot-web config files installed
|
2017-07-31 20:07:30 +00:00
|
|
|
template:
|
2018-12-11 13:48:54 +00:00
|
|
|
src: "{{ item.src }}"
|
|
|
|
dest: "{{ matrix_riot_web_data_path }}/{{ item.name }}"
|
2017-07-31 20:07:30 +00:00
|
|
|
mode: 0644
|
|
|
|
owner: "{{ matrix_user_username }}"
|
|
|
|
group: "{{ matrix_user_username }}"
|
|
|
|
with_items:
|
2019-01-12 15:53:00 +00:00
|
|
|
- {src: "{{ role_path }}/templates/config.json.j2", name: "config.json"}
|
2019-01-27 18:25:13 +00:00
|
|
|
- {src: "{{ role_path }}/templates/nginx.conf.j2", name: "nginx.conf"}
|
2019-04-24 23:05:28 +00:00
|
|
|
- {src: "{{ role_path }}/templates/welcome.html.j2", name: "welcome.html"}
|
2019-02-16 09:48:17 +00:00
|
|
|
- {src: "{{ matrix_riot_web_embedded_pages_home_path }}", name: "home.html"}
|
2019-05-21 15:25:59 +00:00
|
|
|
when: "matrix_riot_web_enabled|bool and item.src is not none"
|
2019-02-16 09:48:17 +00:00
|
|
|
|
|
|
|
- name: Ensure Matrix riot-web config files removed
|
|
|
|
file:
|
|
|
|
path: "{{ matrix_riot_web_data_path }}/{{ item.name }}"
|
|
|
|
state: absent
|
|
|
|
with_items:
|
|
|
|
- {src: "{{ matrix_riot_web_embedded_pages_home_path }}", name: "home.html"}
|
2019-05-21 15:25:59 +00:00
|
|
|
when: "matrix_riot_web_enabled|bool and item.src is none"
|
2017-07-31 20:07:30 +00:00
|
|
|
|
|
|
|
- name: Ensure matrix-riot-web.service installed
|
|
|
|
template:
|
|
|
|
src: "{{ role_path }}/templates/systemd/matrix-riot-web.service.j2"
|
|
|
|
dest: "/etc/systemd/system/matrix-riot-web.service"
|
2017-09-12 09:41:44 +00:00
|
|
|
mode: 0644
|
2019-03-03 09:55:15 +00:00
|
|
|
register: matrix_riot_web_systemd_service_result
|
2019-05-21 15:25:59 +00:00
|
|
|
when: matrix_riot_web_enabled|bool
|
2017-09-12 09:41:44 +00:00
|
|
|
|
2019-03-03 09:55:15 +00:00
|
|
|
- name: Ensure systemd reloaded after matrix-riot-web.service installation
|
|
|
|
service:
|
|
|
|
daemon_reload: yes
|
|
|
|
when: "matrix_riot_web_enabled and matrix_riot_web_systemd_service_result.changed"
|
|
|
|
|
2017-09-12 09:41:44 +00:00
|
|
|
#
|
|
|
|
# Tasks related to getting rid of riot-web (if it was previously enabled)
|
|
|
|
#
|
|
|
|
|
|
|
|
- name: Check existence of matrix-riot-web service
|
2019-01-07 22:35:35 +00:00
|
|
|
stat:
|
|
|
|
path: "/etc/systemd/system/matrix-riot-web.service"
|
2017-09-12 09:41:44 +00:00
|
|
|
register: matrix_riot_web_service_stat
|
2019-05-21 15:25:59 +00:00
|
|
|
when: "not matrix_riot_web_enabled|bool"
|
2017-09-12 09:41:44 +00:00
|
|
|
|
|
|
|
- name: Ensure matrix-riot-web is stopped
|
2019-01-07 22:35:35 +00:00
|
|
|
service:
|
|
|
|
name: matrix-riot-web
|
|
|
|
state: stopped
|
|
|
|
daemon_reload: yes
|
2017-09-12 09:41:44 +00:00
|
|
|
register: stopping_result
|
2019-05-21 15:25:59 +00:00
|
|
|
when: "not matrix_riot_web_enabled|bool and matrix_riot_web_service_stat.stat.exists"
|
2017-09-12 09:41:44 +00:00
|
|
|
|
|
|
|
- name: Ensure matrix-riot-web.service doesn't exist
|
|
|
|
file:
|
|
|
|
path: "/etc/systemd/system/matrix-riot-web.service"
|
|
|
|
state: absent
|
2019-05-21 15:25:59 +00:00
|
|
|
when: "not matrix_riot_web_enabled|bool and matrix_riot_web_service_stat.stat.exists"
|
2017-09-12 09:41:44 +00:00
|
|
|
|
2019-03-03 09:55:15 +00:00
|
|
|
- name: Ensure systemd reloaded after matrix-riot-web.service removal
|
|
|
|
service:
|
|
|
|
daemon_reload: yes
|
2019-05-21 15:25:59 +00:00
|
|
|
when: "not matrix_riot_web_enabled|bool and matrix_riot_web_service_stat.stat.exists"
|
2019-03-03 09:55:15 +00:00
|
|
|
|
2017-09-12 09:41:44 +00:00
|
|
|
- name: Ensure Matrix riot-web paths doesn't exist
|
|
|
|
file:
|
2018-09-17 05:24:35 +00:00
|
|
|
path: "{{ matrix_riot_web_data_path }}"
|
2017-09-12 09:41:44 +00:00
|
|
|
state: absent
|
2019-05-21 15:25:59 +00:00
|
|
|
when: "not matrix_riot_web_enabled|bool"
|
2017-09-12 09:41:44 +00:00
|
|
|
|
|
|
|
- name: Ensure riot-web Docker image doesn't exist
|
|
|
|
docker_image:
|
2018-11-01 06:46:47 +00:00
|
|
|
name: "{{ matrix_riot_web_docker_image }}"
|
2017-09-12 09:41:44 +00:00
|
|
|
state: absent
|
2019-05-21 15:25:59 +00:00
|
|
|
when: "not matrix_riot_web_enabled|bool"
|