From 428e2065b226acebb97625e5062badb64ac658dc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 21 Feb 2024 18:02:22 +0900 Subject: [PATCH] [refactor] turn homeserver.yaml into template --- ansible/playbook/docker-compose.yaml | 9 +++++++ ansible/playbook/ssl.yaml | 9 +++++++ ansible/roles/synapse/tasks/main.yml | 24 +++++++++++++++++-- .../synapse}/homeserver.yaml | 6 ++--- 4 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 ansible/playbook/docker-compose.yaml create mode 100644 ansible/playbook/ssl.yaml rename ansible/roles/synapse/{files/basedir/config => templates/synapse}/homeserver.yaml (99%) diff --git a/ansible/playbook/docker-compose.yaml b/ansible/playbook/docker-compose.yaml new file mode 100644 index 0000000..bad2787 --- /dev/null +++ b/ansible/playbook/docker-compose.yaml @@ -0,0 +1,9 @@ +- name: Add docker-compose + hosts: runa + tasks: + - name: Add docker-compose + include_role: + name: docker-compose + tags: + - docker + when: docker_compose or matrix_service diff --git a/ansible/playbook/ssl.yaml b/ansible/playbook/ssl.yaml new file mode 100644 index 0000000..2b6c170 --- /dev/null +++ b/ansible/playbook/ssl.yaml @@ -0,0 +1,9 @@ +- name: Configure RUNA Matrix VMs + hosts: runa + tasks: + - name: SSL Certs + include_role: + name: ssl-certificates + tags: + - ssl + when: has_ssl_certificates diff --git a/ansible/roles/synapse/tasks/main.yml b/ansible/roles/synapse/tasks/main.yml index e38e3fa..bcddb82 100644 --- a/ansible/roles/synapse/tasks/main.yml +++ b/ansible/roles/synapse/tasks/main.yml @@ -15,7 +15,6 @@ tags: - nginx - dir - - name: Create nginx config ansible.builtin.template: src: "nginx/synapse.conf" @@ -25,7 +24,28 @@ tags: - nginx - synapse - +- name: Create config dir + ansible.builtin.file: + path: /home/{{ ansible_user }}/docker_compose/{{ matrix_service }}/config + state: directory + owner: "{{ ansible_user }}" + mode: '0755' + tags: + - synapse + - dir +- name: Create homeserver configuration + ansible.builtin.template: + src: "synapse/homeserver.yaml" + dest: /home/{{ ansible_user }}/docker_compose/{{ matrix_service }}/config/synapse-worker-{{ item }}.yaml + owner: "{{ ansible_user }}" + mode: '0644' + tags: + - log + - synapse + loop: + - generic + - federation + - sync - name: Create worker configurations ansible.builtin.template: src: "synapse/synapse-worker.yaml" diff --git a/ansible/roles/synapse/files/basedir/config/homeserver.yaml b/ansible/roles/synapse/templates/synapse/homeserver.yaml similarity index 99% rename from ansible/roles/synapse/files/basedir/config/homeserver.yaml rename to ansible/roles/synapse/templates/synapse/homeserver.yaml index 0454c29..a85b9a8 100755 --- a/ansible/roles/synapse/files/basedir/config/homeserver.yaml +++ b/ansible/roles/synapse/templates/synapse/homeserver.yaml @@ -2332,9 +2332,9 @@ oidc_providers: scopes: ["openid", "profile"] user_mapping_provider: config: - localpart_template: "{{ user.preferred_username }}" - display_name_template: "{{ user.name }}" - subject_template: "{{ user.preferred_username }}" + localpart_template: "{{ '{{' }} user.preferred_username {{ '}}' }}" + display_name_template: "{{ '{{' }} user.name {{ '}}' }}" + subject_template: "{{ '{{' }} user.preferred_username {{ '}}' }}" backchannel_logout_enabled: true password_config: