mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2026-06-28 10:44:24 +03:00
Remove matrix-registration (#4919)
* Remove roles/custom/matrix-registration Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Update README.md Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Update configuring-playbook-matrix-registration.md Reuse https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/409c7393a04126341dc4beb7b14590313fcf5e9e/docs/configuring-playbook-dimension.md Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Move entries for matrix-registrations down to the sections for removed components Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Remove a section from registering-users.md Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Remove an entry for matrix-registration from self-building.md Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Remove matrix-registration from matrix_servers Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Remove reference to matrix-registration from matrix-user-verification-service/defaults/main.yml Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Remove an entry for matrix-registration from setup.yml Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Update CHANGELOG.md Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> --------- Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> Co-authored-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2020 - 2022 Slavi Pantaleev
|
||||
# SPDX-FileCopyrightText: 2022 Marko Weltzer
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
---
|
||||
|
||||
- name: Fail if playbook called incorrectly
|
||||
ansible.builtin.fail:
|
||||
msg: "The `one_time` variable needs to be provided to this playbook, via --extra-vars"
|
||||
when: "one_time is not defined or one_time not in ['yes', 'no']"
|
||||
|
||||
- name: Fail if playbook called incorrectly
|
||||
ansible.builtin.fail:
|
||||
msg: "The `ex_date` variable (expiration date) needs to be provided to this playbook, via --extra-vars"
|
||||
when: "ex_date is not defined or ex_date == '<date>'"
|
||||
|
||||
- name: Call matrix-registration token creation API
|
||||
ansible.builtin.uri:
|
||||
url: "{{ matrix_registration_api_token_endpoint }}"
|
||||
follow_redirects: none
|
||||
validate_certs: "{{ matrix_registration_api_validate_certs }}"
|
||||
headers:
|
||||
Content-Type: application/json
|
||||
Authorization: "SharedSecret {{ matrix_registration_admin_secret }}"
|
||||
method: POST
|
||||
body_format: json
|
||||
body: |
|
||||
{
|
||||
"one_time": {{ 'true' if one_time == 'yes' else 'false' }},
|
||||
"ex_date": {{ ex_date | to_json }}
|
||||
}
|
||||
check_mode: false
|
||||
register: matrix_registration_api_result
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_registration_api_result_message: >-
|
||||
matrix-registration result:
|
||||
|
||||
Direct registration link (with the token prefilled):
|
||||
|
||||
{{ matrix_registration_api_register_endpoint }}?token={{ matrix_registration_api_result.json.name }}
|
||||
|
||||
Full token details are:
|
||||
|
||||
{{ matrix_registration_api_result.json }}
|
||||
check_mode: false
|
||||
|
||||
- name: Inject result message into devture_playbook_runtime_messages_list
|
||||
ansible.builtin.set_fact:
|
||||
devture_playbook_runtime_messages_list: |
|
||||
{{
|
||||
devture_playbook_runtime_messages_list | default([])
|
||||
+
|
||||
[matrix_registration_api_result_message]
|
||||
}}
|
||||
check_mode: false
|
||||
@@ -1,37 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2021 MDAD project contributors
|
||||
# SPDX-FileCopyrightText: 2022 Marko Weltzer
|
||||
# SPDX-FileCopyrightText: 2022 Slavi Pantaleev
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
---
|
||||
|
||||
- name: Call matrix-registration list all tokens API
|
||||
ansible.builtin.uri:
|
||||
url: "{{ matrix_registration_api_token_endpoint }}"
|
||||
follow_redirects: none
|
||||
validate_certs: "{{ matrix_registration_api_validate_certs }}"
|
||||
headers:
|
||||
Content-Type: application/json
|
||||
Authorization: "SharedSecret {{ matrix_registration_admin_secret }}"
|
||||
method: GET
|
||||
body_format: json
|
||||
check_mode: false
|
||||
register: matrix_registration_api_result
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_registration_api_result_message: >-
|
||||
matrix-registration result:
|
||||
|
||||
{{ matrix_registration_api_result.json | to_nice_json }}
|
||||
check_mode: false
|
||||
|
||||
- name: Inject result message into devture_playbook_runtime_messages_list
|
||||
ansible.builtin.set_fact:
|
||||
devture_playbook_runtime_messages_list: |
|
||||
{{
|
||||
devture_playbook_runtime_messages_list | default([])
|
||||
+
|
||||
[matrix_registration_api_result_message]
|
||||
}}
|
||||
check_mode: false
|
||||
@@ -1,38 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2020 - 2024 Slavi Pantaleev
|
||||
# SPDX-FileCopyrightText: 2021 MDAD project contributors
|
||||
# SPDX-FileCopyrightText: 2022 Marko Weltzer
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
---
|
||||
|
||||
- tags:
|
||||
- setup-all
|
||||
- setup-matrix-registration
|
||||
- install-all
|
||||
- install-matrix-registration
|
||||
block:
|
||||
- when: matrix_registration_enabled | bool
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||
|
||||
- when: matrix_registration_enabled | bool
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||
|
||||
- tags:
|
||||
- setup-all
|
||||
- setup-matrix-registration
|
||||
block:
|
||||
- when: not matrix_registration_enabled | bool
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||
|
||||
- tags:
|
||||
- generate-matrix-registration-token
|
||||
block:
|
||||
- when: matrix_registration_enabled | bool
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/generate_token.yml"
|
||||
|
||||
- tags:
|
||||
- list-matrix-registration-tokens
|
||||
block:
|
||||
- when: matrix_registration_enabled | bool
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/list_tokens.yml"
|
||||
@@ -1,149 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2020 - 2024 Slavi Pantaleev
|
||||
# SPDX-FileCopyrightText: 2020 Stuart Mumford
|
||||
# SPDX-FileCopyrightText: 2022 Jim Myhrberg
|
||||
# SPDX-FileCopyrightText: 2022 Marko Weltzer
|
||||
# SPDX-FileCopyrightText: 2022 Nikita Chernyi
|
||||
# SPDX-FileCopyrightText: 2022 Sebastian Gumprich
|
||||
# SPDX-FileCopyrightText: 2024 David Mehren
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
---
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_registration_migration_requires_restart: false
|
||||
|
||||
- when: "matrix_registration_database_engine == 'postgres'"
|
||||
block:
|
||||
- name: Check if an SQLite database already exists
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_registration_sqlite_database_path_local }}"
|
||||
register: matrix_registration_sqlite_database_path_local_stat_result
|
||||
|
||||
- when: "matrix_registration_sqlite_database_path_local_stat_result.stat.exists | bool"
|
||||
block:
|
||||
- ansible.builtin.include_role:
|
||||
name: galaxy/postgres
|
||||
tasks_from: migrate_db_to_postgres
|
||||
vars:
|
||||
postgres_db_migration_request:
|
||||
src: "{{ matrix_registration_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_registration_database_connection_string }}"
|
||||
caller: "{{ role_path | basename }}"
|
||||
engine_variable_name: 'matrix_registration_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-registration.service']
|
||||
# pgloader makes `ex_date` of type `TIMESTAMP WITH TIMEZONE`,
|
||||
# which makes matrix-registration choke on it later on when comparing dates.
|
||||
additional_psql_statements_list:
|
||||
- ALTER TABLE tokens ALTER COLUMN ex_date TYPE TIMESTAMP WITHOUT TIME ZONE;
|
||||
additional_psql_statements_db_name: "{{ matrix_registration_database_name }}"
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_registration_migration_requires_restart: true
|
||||
|
||||
- name: Ensure matrix-registration paths exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
mode: '0750'
|
||||
owner: "{{ matrix_user_name }}"
|
||||
group: "{{ matrix_group_name }}"
|
||||
with_items:
|
||||
- {path: "{{ matrix_registration_base_path }}", when: true}
|
||||
- {path: "{{ matrix_registration_config_path }}", when: true}
|
||||
- {path: "{{ matrix_registration_data_path }}", when: true}
|
||||
- {path: "{{ matrix_registration_container_src_files_path }}", when: "{{ matrix_registration_container_image_self_build }}"}
|
||||
when: "item.when | bool"
|
||||
|
||||
- name: Ensure matrix-registration image is pulled
|
||||
community.docker.docker_image_pull:
|
||||
name: "{{ matrix_registration_container_image }}"
|
||||
pull: always
|
||||
when: "not matrix_registration_container_image_self_build | bool"
|
||||
register: matrix_registration_container_image_pull_result
|
||||
retries: "{{ devture_playbook_help_container_retries_count }}"
|
||||
delay: "{{ devture_playbook_help_container_retries_delay }}"
|
||||
until: matrix_registration_container_image_pull_result is not failed
|
||||
|
||||
- name: Ensure matrix-registration repository is present when self-building
|
||||
ansible.builtin.git:
|
||||
repo: "{{ matrix_registration_container_image_self_build_repo }}"
|
||||
dest: "{{ matrix_registration_container_src_files_path }}"
|
||||
version: "{{ matrix_registration_container_image_self_build_branch }}"
|
||||
force: "yes"
|
||||
become: true
|
||||
become_user: "{{ matrix_user_name }}"
|
||||
register: matrix_registration_git_pull_results
|
||||
when: "matrix_registration_container_image_self_build | bool"
|
||||
|
||||
# See: https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1864
|
||||
- name: Patch setup.py to allow self-built version to work
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ matrix_registration_container_src_files_path }}/setup.py"
|
||||
regexp: 'flask-limiter'
|
||||
line: '"flask-limiter~=1.1.0", "Markupsafe<2.1",'
|
||||
when: "matrix_registration_container_image_self_build | bool and matrix_registration_container_image_self_build_python_dependencies_patch_enabled | bool"
|
||||
|
||||
- name: Ensure matrix-registration Docker image is built
|
||||
community.docker.docker_image_build:
|
||||
name: "{{ matrix_registration_container_image }}"
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_registration_container_src_files_path }}"
|
||||
pull: true
|
||||
rebuild: "{{ 'always' if matrix_registration_git_pull_results.changed | bool else 'never' }}"
|
||||
when: "matrix_registration_container_image_self_build | bool"
|
||||
register: matrix_registration_container_image_build_result
|
||||
|
||||
- name: Ensure matrix-registration config installed
|
||||
ansible.builtin.copy:
|
||||
content: "{{ matrix_registration_configuration | to_nice_yaml(indent=2, width=999999) }}"
|
||||
dest: "{{ matrix_registration_config_path }}/config.yaml"
|
||||
mode: '0644'
|
||||
owner: "{{ matrix_user_name }}"
|
||||
group: "{{ matrix_group_name }}"
|
||||
register: matrix_registration_config_result
|
||||
|
||||
- name: Ensure matrix-registration support files installed
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/{{ item }}.j2"
|
||||
dest: "{{ matrix_registration_base_path }}/{{ item }}"
|
||||
mode: '0640'
|
||||
owner: "{{ matrix_user_name }}"
|
||||
group: "{{ matrix_group_name }}"
|
||||
with_items:
|
||||
- labels
|
||||
register: matrix_registration_support_files_result
|
||||
|
||||
- name: Ensure matrix-registration container network is created
|
||||
community.general.docker_network:
|
||||
enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
|
||||
name: "{{ matrix_registration_container_network }}"
|
||||
driver: bridge
|
||||
driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
|
||||
|
||||
- name: Ensure matrix-registration.service installed
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-registration.service.j2"
|
||||
dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-registration.service"
|
||||
mode: '0644'
|
||||
register: matrix_registration_systemd_service_result
|
||||
|
||||
- name: Determine whether matrix-registration needs a restart
|
||||
ansible.builtin.set_fact:
|
||||
matrix_registration_restart_necessary: >-
|
||||
{{
|
||||
matrix_registration_migration_requires_restart | default(false)
|
||||
or matrix_registration_config_result.changed | default(false)
|
||||
or matrix_registration_support_files_result.changed | default(false)
|
||||
or matrix_registration_systemd_service_result.changed | default(false)
|
||||
or matrix_registration_container_image_pull_result.changed | default(false)
|
||||
or matrix_registration_container_image_build_result.changed | default(false)
|
||||
}}
|
||||
|
||||
- name: Ensure matrix-registration.service restarted, if necessary
|
||||
ansible.builtin.service:
|
||||
name: "matrix-registration.service"
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
when: "matrix_registration_migration_requires_restart | bool"
|
||||
@@ -1,26 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2020 - 2022 Slavi Pantaleev
|
||||
# SPDX-FileCopyrightText: 2022 Marko Weltzer
|
||||
# SPDX-FileCopyrightText: 2022 Sebastian Gumprich
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
---
|
||||
|
||||
- name: Check existence of matrix-registration service
|
||||
ansible.builtin.stat:
|
||||
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-registration.service"
|
||||
register: matrix_registration_service_stat
|
||||
|
||||
- when: matrix_registration_service_stat.stat.exists | bool
|
||||
block:
|
||||
- name: Ensure matrix-registration is stopped
|
||||
ansible.builtin.service:
|
||||
name: matrix-registration
|
||||
state: stopped
|
||||
enabled: false
|
||||
daemon_reload: true
|
||||
|
||||
- name: Ensure matrix-registration.service doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-registration.service"
|
||||
state: absent
|
||||
@@ -1,37 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2020 - 2024 Slavi Pantaleev
|
||||
# SPDX-FileCopyrightText: 2025 Suguru Hirahara
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
---
|
||||
|
||||
- name: (Deprecation) Catch and report renamed settings
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
Your configuration contains a variable, which now has a different name.
|
||||
Please rename the variable (`{{ item.old }}` -> `{{ item.new }}`) on your configuration file (vars.yml).
|
||||
when: "lookup('ansible.builtin.varnames', ('^' + item.old + '$'), wantlist=True) | length > 0"
|
||||
with_items:
|
||||
- {'old': 'matrix_registration_docker_repo', 'new': 'matrix_registration_container_image_self_build_repo'}
|
||||
- {'old': 'matrix_registration_public_endpoint', 'new': 'matrix_registration_path_prefix'}
|
||||
- {'old': 'matrix_registration_docker_image', 'new': 'matrix_registration_container_image'}
|
||||
- {'old': 'matrix_registration_docker_image_force_pull', 'new': 'matrix_registration_container_image_force_pull'}
|
||||
- {'old': 'matrix_registration_docker_image_registry_prefix', 'new': 'matrix_registration_container_image_registry_prefix'}
|
||||
- {'old': 'matrix_registration_docker_image_registry_prefix_upstream', 'new': 'matrix_registration_container_image_registry_prefix_upstream'}
|
||||
- {'old': 'matrix_registration_docker_image_registry_prefix_upstream_default', 'new': 'matrix_registration_container_image_registry_prefix_upstream_default'}
|
||||
- {'old': 'matrix_registration_docker_src_files_path', 'new': 'matrix_registration_container_src_files_path'}
|
||||
- {'old': 'matrix_registration_container_image_force_pull', 'new': '<removed> (the new community.docker.docker_image_pull module handles this natively)'}
|
||||
|
||||
- name: Fail if required matrix-registration settings not defined
|
||||
ansible.builtin.fail:
|
||||
msg: >
|
||||
You need to define a required configuration setting (`{{ item.name }}`).
|
||||
when: "item.when | bool and lookup('vars', item.name, default='') | string | length == 0"
|
||||
with_items:
|
||||
- {'name': 'matrix_registration_hostname', when: true}
|
||||
- {'name': 'matrix_registration_path_prefix', when: true}
|
||||
- {'name': 'matrix_registration_container_network', when: true}
|
||||
- {'name': 'matrix_registration_shared_secret', when: true}
|
||||
- {'name': 'matrix_registration_admin_secret', when: true}
|
||||
- {'name': 'matrix_registration_server_location', when: true}
|
||||
- {'name': 'matrix_registration_database_hostname', when: "{{ matrix_registration_database_engine == 'postgres' }}"}
|
||||
Reference in New Issue
Block a user