53 lines
1.8 KiB
YAML
53 lines
1.8 KiB
YAML
- name: "Create {{ synapse_project_dir }} project directory"
|
||
file:
|
||
path: "{{ synapse_project_dir }}"
|
||
state: directory
|
||
|
||
- name: Template docker-compose.yaml to project directory
|
||
template:
|
||
src: docker-compose.yaml
|
||
dest: "{{ synapse_project_dir }}/docker-compose.yaml"
|
||
owner: "{{ ansible_env['USER'] }}"
|
||
group: "{{ ansible_env['USER'] }}"
|
||
mode: '640'
|
||
|
||
- name: Template homeserver.yaml to project directory
|
||
template:
|
||
src: homeserver.yaml
|
||
dest: "{{ synapse_project_dir }}/homeserver.yaml"
|
||
owner: "{{ ansible_env['USER'] }}"
|
||
mode: '640'
|
||
# Store result to restart services if the file changed
|
||
register: synapse_template_homeserver_result
|
||
|
||
# Separate task because template module cannot chown/chgrp to a non-existing user/group
|
||
- name: "Change group of homeserver.yaml to synapse GID ({{ users['synapse'] + uid_shift }})"
|
||
file:
|
||
path: "{{ synapse_project_dir }}/homeserver.yaml"
|
||
group: "{{ users['synapse'] + uid_shift }}"
|
||
become: true
|
||
|
||
- name: "Create directory {{ volumes['synapse_datadir'] }} with correct permissions"
|
||
file:
|
||
path: "{{ volumes['synapse_datadir'] }}"
|
||
state: directory
|
||
owner: "{{ users['synapse'] + uid_shift }}"
|
||
group: "{{ users['synapse'] + uid_shift }}"
|
||
mode: '770'
|
||
become: true
|
||
|
||
- name: "Create directory {{ volumes['synapse_postgres_datadir'] }} with correct permissions"
|
||
file:
|
||
path: "{{ volumes['synapse_postgres_datadir'] }}"
|
||
state: directory
|
||
owner: "{{ users['synapse_postgres'] + uid_shift }}"
|
||
group: "{{ users['synapse_postgres'] + uid_shift }}"
|
||
mode: '770'
|
||
become: true
|
||
|
||
- name: Pull/Create/Restart project services
|
||
community.docker.docker_compose:
|
||
project_src: "{{ synapse_project_dir }}"
|
||
pull: "{{ docker_pull_images | bool }}"
|
||
# Restart if config file(s) changed
|
||
restarted: "{{ synapse_template_homeserver_result['changed'] | bool }}"
|