# vim: ft=yaml.ansible
---
- name: Create subfolders
  file:
    name: "{{ services.matrix.volume_folder }}/{{ volume }}"
    state: directory
    owner: "991"
    group: "991"
  loop:
    - data
    - data/uploads
    - data/media
  loop_control:
    loop_var: volume

- name: Create Matrix DB subfolder
  file:
    name: "{{ services.matrix.volume_folder }}/db"
    state: directory

- name: Upload vhost config for Matrix domain
  copy:
    src: vhost/matrix
    dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.matrix.domain }}"

- name: Upload homeserver.yaml
  template:
    src: matrix/homeserver.yaml.j2
    dest: "{{ services.matrix.volume_folder }}/data/homeserver.yaml"

- name: Upload Matrix logging config
  copy:
    src: matrix/log.config
    dest: "{{ services.matrix.volume_folder }}/data/matrix.data.coop.log.config"