matrix-docker-ansible-deploy/roles/matrix-base/tasks/setup_matrix_base.yml
Slavi Pantaleev 8fea6f5130 Make sure matrix_user_uid and matrix_user_gid are always set
If one runs the playbook with `--tags=setup-all`, it would have been
fine.

But running with a specific tag (e.g. `--tags=setup-riot-web`) would
have made that initialization be skipped, and the `matrix-riot-web` role
would fail, due to missing variables.
2020-05-06 09:43:30 +03:00

44 lines
1.3 KiB
YAML

---
- name: Ensure Matrix base path exists
file:
path: "{{ item }}"
state: directory
mode: "{{ matrix_base_data_path_mode }}"
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_username }}"
with_items:
- "{{ matrix_base_data_path }}"
# `docker_network` doesn't work as expected when the given network
# is a substring of a network that already exists.
#
# See:
# - https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/12
# - https://github.com/ansible/ansible/issues/32926
#
# Due to that, we employ a workaround below.
#
# - name: Ensure Matrix network is created in Docker
# docker_network:
# name: "{{ matrix_docker_network }}"
# driver: bridge
- name: Check existence of Matrix network in Docker
shell:
cmd: "docker network ls -q --filter='name=^{{ matrix_docker_network }}$'"
register: result_check_docker_network
changed_when: false
check_mode: no
- name: Create Matrix network in Docker
shell:
cmd: "docker network create --driver=bridge {{ matrix_docker_network }}"
when: "result_check_docker_network.stdout == '' and not ansible_check_mode"
- name: Ensure matrix-remove-all script created
template:
src: "{{ role_path }}/templates/usr-local-bin/matrix-remove-all.j2"
dest: "{{ matrix_local_bin_path }}/matrix-remove-all"
mode: 0750