matrix-docker-ansible-deploy/roles/matrix-server/tasks/setup_riot_web.yml

70 lines
2.0 KiB
YAML
Raw Normal View History

2017-07-31 20:07:30 +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:
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 }}"
when: matrix_riot_web_enabled
2017-07-31 20:07:30 +00:00
- name: Ensure riot-web Docker image is pulled
docker_image:
name: "{{ matrix_docker_image_riot }}"
when: matrix_riot_web_enabled
2017-07-31 20:07:30 +00:00
- name: Ensure Matrix riot-web configured
template:
src: "{{ role_path }}/templates/riot-web/{{ item }}.j2"
dest: "{{ matrix_riot_web_data_path }}/{{ item }}"
2017-07-31 20:07:30 +00:00
mode: 0644
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_username }}"
with_items:
- "riot.im.conf"
- "config.json"
when: matrix_riot_web_enabled
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"
mode: 0644
when: matrix_riot_web_enabled
#
# Tasks related to getting rid of riot-web (if it was previously enabled)
#
- name: Check existence of matrix-riot-web service
stat: path="/etc/systemd/system/matrix-riot-web.service"
register: matrix_riot_web_service_stat
- name: Ensure matrix-riot-web is stopped
service: name=matrix-riot-web state=stopped daemon_reload=yes
register: stopping_result
when: "not matrix_riot_web_enabled and matrix_riot_web_service_stat.stat.exists"
- name: Ensure matrix-riot-web.service doesn't exist
file:
path: "/etc/systemd/system/matrix-riot-web.service"
state: absent
when: "not matrix_riot_web_enabled and matrix_riot_web_service_stat.stat.exists"
- name: Ensure Matrix riot-web paths doesn't exist
file:
path: "{{ matrix_riot_web_data_path }}"
state: absent
when: "not matrix_riot_web_enabled"
- name: Ensure riot-web Docker image doesn't exist
docker_image:
name: "{{ matrix_docker_image_riot }}"
state: absent
when: "not matrix_riot_web_enabled"