Просмотр исходного кода

Split Synapse extension tasks into install/uninstall files

pull/179/head
Slavi Pantaleev 6 лет назад
Родитель
Сommit
e3b4622ac8
6 измененных файлов: 80 добавлений и 90 удалений
  1. +30
    -0
      roles/matrix-synapse/tasks/ext/rest-auth/setup-install.yml
  2. +6
    -0
      roles/matrix-synapse/tasks/ext/rest-auth/setup-uninstall.yml
  3. +4
    -45
      roles/matrix-synapse/tasks/ext/rest-auth/setup.yml
  4. +30
    -0
      roles/matrix-synapse/tasks/ext/shared-secret-auth/setup-install.yml
  5. +6
    -0
      roles/matrix-synapse/tasks/ext/shared-secret-auth/setup-uninstall.yml
  6. +4
    -45
      roles/matrix-synapse/tasks/ext/shared-secret-auth/setup.yml

+ 30
- 0
roles/matrix-synapse/tasks/ext/rest-auth/setup-install.yml Просмотреть файл

@@ -0,0 +1,30 @@
---

- name: Fail if REST Auth endpoint not configured
fail:
msg: "You have enabled the REST Auth password provider, but have not configured its endpoint in the `matrix_synapse_ext_password_provider_rest_auth_endpoint` variable. Consult the documentation."
when: "matrix_synapse_ext_password_provider_rest_auth_endpoint == ''"

- name: Download matrix-synapse-rest-auth
get_url:
url: "{{ matrix_synapse_ext_password_provider_rest_auth_download_url }}"
dest: "{{ matrix_synapse_ext_path }}/rest_auth_provider.py"
force: true
mode: 0440
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_username }}"

- set_fact:
matrix_synapse_password_providers_enabled: true

- set_fact:
matrix_synapse_container_additional_volumes: >
{{ matrix_synapse_container_additional_volumes }}
+
{{ [{'src': '{{ matrix_synapse_ext_path }}/rest_auth_provider.py', 'dst': '{{ matrix_synapse_in_container_python_packages_path }}/rest_auth_provider.py', 'options': 'ro'}] }}

- set_fact:
matrix_synapse_additional_loggers: >
{{ matrix_synapse_additional_loggers }}
+
{{ [{'name': 'rest_auth_provider', 'level': 'INFO'}] }}

+ 6
- 0
roles/matrix-synapse/tasks/ext/rest-auth/setup-uninstall.yml Просмотреть файл

@@ -0,0 +1,6 @@
---

- name: Ensure matrix-synapse-rest-auth doesn't exist
file:
path: "{{ matrix_synapse_ext_path }}/rest_auth_provider.py"
state: absent

+ 4
- 45
roles/matrix-synapse/tasks/ext/rest-auth/setup.yml Просмотреть файл

@@ -1,48 +1,7 @@
---

#
# Tasks related to setting up matrix-synapse-rest-auth
#
- import_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup-install.yml"
when: matrix_synapse_ext_password_provider_rest_auth_enabled

- name: Fail if REST Auth enabled, but endpoint not configured
fail:
msg: "You have enabled the REST Auth password provider, but have not configured its endpoint in the `matrix_synapse_ext_password_provider_rest_auth_endpoint` variable. Consult the documentation."
when: "matrix_synapse_ext_password_provider_rest_auth_enabled and matrix_synapse_ext_password_provider_rest_auth_endpoint == ''"

- name: Download matrix-synapse-rest-auth
get_url:
url: "{{ matrix_synapse_ext_password_provider_rest_auth_download_url }}"
dest: "{{ matrix_synapse_ext_path }}/rest_auth_provider.py"
force: true
mode: 0440
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_username }}"
when: "matrix_synapse_ext_password_provider_rest_auth_enabled"

- set_fact:
matrix_synapse_password_providers_enabled: true
when: "matrix_synapse_ext_password_provider_rest_auth_enabled"

- set_fact:
matrix_synapse_container_additional_volumes: >
{{ matrix_synapse_container_additional_volumes }}
+
{{ [{'src': '{{ matrix_synapse_ext_path }}/rest_auth_provider.py', 'dst': '{{ matrix_synapse_in_container_python_packages_path }}/rest_auth_provider.py', 'options': 'ro'}] }}
when: "matrix_synapse_ext_password_provider_rest_auth_enabled"

- set_fact:
matrix_synapse_additional_loggers: >
{{ matrix_synapse_additional_loggers }}
+
{{ [{'name': 'rest_auth_provider', 'level': 'INFO'}] }}
when: "matrix_synapse_ext_password_provider_rest_auth_enabled"

#
# Tasks related to getting rid of matrix-synapse-rest-auth (if it was previously enabled)
#

- name: Ensure matrix-synapse-rest-auth doesn't exist
file:
path: "{{ matrix_synapse_ext_path }}/rest_auth_provider.py"
state: absent
when: "not matrix_synapse_ext_password_provider_rest_auth_enabled"
- import_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup-uninstall.yml"
when: "not matrix_synapse_ext_password_provider_rest_auth_enabled"

+ 30
- 0
roles/matrix-synapse/tasks/ext/shared-secret-auth/setup-install.yml Просмотреть файл

@@ -0,0 +1,30 @@
---

- name: Fail if Shared Secret Auth secret not set
fail:
msg: "Shared Secret Auth is enabled, but no secret has been set in matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret"
when: "matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret == ''"

- name: Download matrix-synapse-shared-secret-auth
get_url:
url: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_download_url }}"
dest: "{{ matrix_synapse_ext_path }}/shared_secret_authenticator.py"
force: true
mode: 0440
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_username }}"

- set_fact:
matrix_synapse_password_providers_enabled: true

- set_fact:
matrix_synapse_container_additional_volumes: >
{{ matrix_synapse_container_additional_volumes }}
+
{{ [{'src': '{{ matrix_synapse_ext_path }}/shared_secret_authenticator.py', 'dst': '{{ matrix_synapse_in_container_python_packages_path }}/shared_secret_authenticator.py', 'options': 'ro'}] }}

- set_fact:
matrix_synapse_additional_loggers: >
{{ matrix_synapse_additional_loggers }}
+
{{ [{'name': 'shared_secret_authenticator', 'level': 'INFO'}] }}

+ 6
- 0
roles/matrix-synapse/tasks/ext/shared-secret-auth/setup-uninstall.yml Просмотреть файл

@@ -0,0 +1,6 @@
---

- name: Ensure matrix-synapse-shared-secret-auth doesn't exist
file:
path: "{{ matrix_synapse_ext_path }}/shared_secret_authenticator.py"
state: absent

+ 4
- 45
roles/matrix-synapse/tasks/ext/shared-secret-auth/setup.yml Просмотреть файл

@@ -1,48 +1,7 @@
---

#
# Tasks related to setting up matrix-synapse-shared-secret-auth
#
- import_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup-install.yml"
when: matrix_synapse_ext_password_provider_shared_secret_auth_enabled

- name: Fail if Shared Secret Auth enabled, but no secret set
fail:
msg: "Shared Secret Auth is enabled, but no secret has been set in matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret"
when: "matrix_synapse_ext_password_provider_shared_secret_auth_enabled and matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret == ''"

- name: Download matrix-synapse-shared-secret-auth
get_url:
url: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_download_url }}"
dest: "{{ matrix_synapse_ext_path }}/shared_secret_authenticator.py"
force: true
mode: 0440
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_username }}"
when: "matrix_synapse_ext_password_provider_shared_secret_auth_enabled"

- set_fact:
matrix_synapse_password_providers_enabled: true
when: "matrix_synapse_ext_password_provider_shared_secret_auth_enabled"

- set_fact:
matrix_synapse_container_additional_volumes: >
{{ matrix_synapse_container_additional_volumes }}
+
{{ [{'src': '{{ matrix_synapse_ext_path }}/shared_secret_authenticator.py', 'dst': '{{ matrix_synapse_in_container_python_packages_path }}/shared_secret_authenticator.py', 'options': 'ro'}] }}
when: "matrix_synapse_ext_password_provider_shared_secret_auth_enabled"

- set_fact:
matrix_synapse_additional_loggers: >
{{ matrix_synapse_additional_loggers }}
+
{{ [{'name': 'shared_secret_authenticator', 'level': 'INFO'}] }}
when: "matrix_synapse_ext_password_provider_shared_secret_auth_enabled"

#
# Tasks related to getting rid of matrix-synapse-shared-secret-auth (if it was previously enabled)
#

- name: Ensure matrix-synapse-shared-secret-auth doesn't exist
file:
path: "{{ matrix_synapse_ext_path }}/shared_secret_authenticator.py"
state: absent
when: "not matrix_synapse_ext_password_provider_shared_secret_auth_enabled"
- import_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup-uninstall.yml"
when: "not matrix_synapse_ext_password_provider_shared_secret_auth_enabled"

Загрузка…
Отмена
Сохранить