From cde72ad3405b0d0c8fbfc5d37bbf2741bd8d419e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 21 Feb 2024 17:41:10 +0900 Subject: [PATCH] [refactor] move worker configs into template --- ansible/inventory/runa.yml | 1 + .../config/synapse-worker-federation.yaml | 20 ------------------- .../basedir/config/synapse-worker-sync.yaml | 20 ------------------- ansible/roles/synapse/tasks/main.yml | 17 ++++++++++++++-- .../synapse/synapse-worker.yaml} | 4 ++-- 5 files changed, 18 insertions(+), 44 deletions(-) delete mode 100755 ansible/roles/synapse/files/basedir/config/synapse-worker-federation.yaml delete mode 100755 ansible/roles/synapse/files/basedir/config/synapse-worker-sync.yaml rename ansible/roles/synapse/{files/basedir/config/synapse-worker-generic.yaml => templates/synapse/synapse-worker.yaml} (78%) diff --git a/ansible/inventory/runa.yml b/ansible/inventory/runa.yml index ccfabbc..8157ca0 100644 --- a/ansible/inventory/runa.yml +++ b/ansible/inventory/runa.yml @@ -63,6 +63,7 @@ runa: mtx-elem-1.lta.internal.ru.com: matrix_service: "elementweb" mtx-syna-1.lta.internal.ru.com: + matrix_service: "synapse" nfs: mounts: - src: mtx-storage-1.lta.internal.ru.com:/srv/nfs_synapse diff --git a/ansible/roles/synapse/files/basedir/config/synapse-worker-federation.yaml b/ansible/roles/synapse/files/basedir/config/synapse-worker-federation.yaml deleted file mode 100755 index 7e5b619..0000000 --- a/ansible/roles/synapse/files/basedir/config/synapse-worker-federation.yaml +++ /dev/null @@ -1,20 +0,0 @@ -worker_app: synapse.app.generic_worker -worker_name: synapse-worker-federation - -worker_log_config: /config/log-worker-federation.yaml - -worker_listeners: - - type: http - port: 8008 - x_forwarded: true - resources: - - names: - - client - - federation - - port: 9000 - type: metrics - tls: false - x_forwarded: true - resources: - - names: [metrics] - compress: false diff --git a/ansible/roles/synapse/files/basedir/config/synapse-worker-sync.yaml b/ansible/roles/synapse/files/basedir/config/synapse-worker-sync.yaml deleted file mode 100755 index c812e02..0000000 --- a/ansible/roles/synapse/files/basedir/config/synapse-worker-sync.yaml +++ /dev/null @@ -1,20 +0,0 @@ -worker_app: synapse.app.generic_worker -worker_name: synapse-worker-sync - -worker_log_config: /config/log-worker-sync.yaml - -worker_listeners: - - type: http - port: 8008 - x_forwarded: true - resources: - - names: - - client - - federation - - port: 9000 - type: metrics - tls: false - x_forwarded: true - resources: - - names: [metrics] - compress: false diff --git a/ansible/roles/synapse/tasks/main.yml b/ansible/roles/synapse/tasks/main.yml index 1c55583..e38e3fa 100644 --- a/ansible/roles/synapse/tasks/main.yml +++ b/ansible/roles/synapse/tasks/main.yml @@ -26,10 +26,23 @@ - nginx - synapse +- name: Create worker configurations + ansible.builtin.template: + src: "synapse/synapse-worker.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 log configurations ansible.builtin.template: - src: "nginx/synapse.conf" - dest: /home/{{ ansible_user }}/docker_compose/{{ matrix_service }}/config/log-{{ item }}.conf + src: "synapse/log.yaml" + dest: /home/{{ ansible_user }}/docker_compose/{{ matrix_service }}/config/log-{{ item }}.yaml owner: "{{ ansible_user }}" mode: '0644' tags: diff --git a/ansible/roles/synapse/files/basedir/config/synapse-worker-generic.yaml b/ansible/roles/synapse/templates/synapse/synapse-worker.yaml similarity index 78% rename from ansible/roles/synapse/files/basedir/config/synapse-worker-generic.yaml rename to ansible/roles/synapse/templates/synapse/synapse-worker.yaml index b304133..2023de4 100755 --- a/ansible/roles/synapse/files/basedir/config/synapse-worker-generic.yaml +++ b/ansible/roles/synapse/templates/synapse/synapse-worker.yaml @@ -1,7 +1,7 @@ worker_app: synapse.app.generic_worker -worker_name: synapse-worker-generic +worker_name: synapse-worker-{{ item }} -worker_log_config: /config/log-worker-generic.yaml +worker_log_config: /config/log-worker-{{ item }}.yaml worker_listeners: - port: 8008