- name: create {{ MATRIX_WELL_KNOWN_DIRECTORY }}
  file:
    path: "{{ MATRIX_WELL_KNOWN_DIRECTORY }}"
    state: directory
    mode: '0755'

- name: create {{ MATRIX_WELL_KNOWN_FILE }}
  template: 
    src:  "well-known.j2" 
    dest: "{{ MATRIX_WELL_KNOWN_FILE }}"
        
- name: "include role srv-proxy-6-6-domain for {{ MATRIX_ELEMENT_DOMAIN }}"
  include_role: 
    name: srv-proxy-6-6-domain
  vars:        
    domain:     "{{ MATRIX_ELEMENT_DOMAIN }}"
    http_port:  "{{ MATRIX_ELEMENT_PORT }}"

- name: "include role for {{ application_id }} to receive certs & do modification routines for {{ MATRIX_SYNAPSE_DOMAIN }}"
  include_role:
    name: srv-web-7-6-composer
  vars:
    domain:     "{{ MATRIX_SYNAPSE_DOMAIN }}"
    http_port:  "{{ MATRIX_SYNAPSE_PORT }}"

- name: create {{ MATRIX_SYNAPSE_DOMAIN }}.conf
  template: 
    src:  "templates/nginx.conf.j2" 
    dest: "{{ NGINX.DIRECTORIES.HTTP.SERVERS }}{{ MATRIX_SYNAPSE_DOMAIN }}.conf"
  vars:
    domain:     "{{ MATRIX_SYNAPSE_DOMAIN }}"
    http_port:  "{{ MATRIX_SYNAPSE_PORT }}"
  notify: restart openresty