From 72744f9db90fe9024a4b9a0e3d28f0a4a06f34e6 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sun, 27 Nov 2022 09:26:18 +0200 Subject: [PATCH] /usr/local/bin/matrix-synapse-register-user -> /matrix/synapse/bin/register-user --- docs/registering-users.md | 2 +- roles/custom/matrix-synapse/defaults/main.yml | 1 + roles/custom/matrix-synapse/tasks/register_user.yml | 3 ++- roles/custom/matrix-synapse/tasks/setup_install.yml | 1 + .../matrix-synapse/tasks/synapse/setup_install.yml | 12 +++--------- .../register-user.j2} | 0 6 files changed, 8 insertions(+), 11 deletions(-) rename roles/custom/matrix-synapse/templates/synapse/{usr-local-bin/matrix-synapse-register-user.j2 => bin/register-user.j2} (100%) diff --git a/docs/registering-users.md b/docs/registering-users.md index 90c065bf..83f31a22 100644 --- a/docs/registering-users.md +++ b/docs/registering-users.md @@ -23,7 +23,7 @@ ansible-playbook -i inventory/hosts setup.yml --extra-vars='username= +/matrix/synapse/bin/register-user ``` **Note**: `` is just a plain username (like `john`), not your full `@:` identifier. diff --git a/roles/custom/matrix-synapse/defaults/main.yml b/roles/custom/matrix-synapse/defaults/main.yml index 9a93a437..d643400c 100644 --- a/roles/custom/matrix-synapse/defaults/main.yml +++ b/roles/custom/matrix-synapse/defaults/main.yml @@ -55,6 +55,7 @@ matrix_synapse_config_dir_path: "{{ matrix_synapse_base_path }}/config" matrix_synapse_storage_path: "{{ matrix_synapse_base_path }}/storage" matrix_synapse_media_store_path: "{{ matrix_synapse_storage_path }}/media-store" matrix_synapse_ext_path: "{{ matrix_synapse_base_path }}/ext" +matrix_synapse_bin_path: "{{ matrix_synapse_base_path }}/bin" matrix_synapse_ext_s3_storage_provider_path: "{{ matrix_synapse_base_path }}/ext/s3-storage-provider" matrix_synapse_container_client_api_port: 8008 diff --git a/roles/custom/matrix-synapse/tasks/register_user.yml b/roles/custom/matrix-synapse/tasks/register_user.yml index 81748449..21540959 100644 --- a/roles/custom/matrix-synapse/tasks/register_user.yml +++ b/roles/custom/matrix-synapse/tasks/register_user.yml @@ -28,6 +28,7 @@ when: "start_result.changed" - name: Register user - ansible.builtin.command: "{{ matrix_local_bin_path }}/matrix-synapse-register-user {{ username | quote }} {{ password | quote }} {{ '1' if admin == 'yes' else '0' }}" + ansible.builtin.command: + cmd: "{{ matrix_synapse_bin_path }}/register-user {{ username | quote }} {{ password | quote }} {{ '1' if admin == 'yes' else '0' }}" register: matrix_synapse_register_user_result changed_when: matrix_synapse_register_user_result.rc == 0 diff --git a/roles/custom/matrix-synapse/tasks/setup_install.yml b/roles/custom/matrix-synapse/tasks/setup_install.yml index 3d56177c..0be0fd2f 100644 --- a/roles/custom/matrix-synapse/tasks/setup_install.yml +++ b/roles/custom/matrix-synapse/tasks/setup_install.yml @@ -10,6 +10,7 @@ with_items: - {path: "{{ matrix_synapse_config_dir_path }}", when: true} - {path: "{{ matrix_synapse_ext_path }}", when: true} + - {path: "{{ matrix_synapse_bin_path }}", when: true} - {path: "{{ matrix_synapse_docker_src_files_path }}", when: "{{ matrix_synapse_container_image_self_build }}"} - {path: "{{ matrix_synapse_customized_docker_src_files_path }}", when: "{{ matrix_synapse_container_image_customizations_enabled }}"} - {path: "{{ matrix_synapse_ext_s3_storage_provider_path }}", when: "{{ matrix_synapse_ext_synapse_s3_storage_provider_enabled }}"} diff --git a/roles/custom/matrix-synapse/tasks/synapse/setup_install.yml b/roles/custom/matrix-synapse/tasks/synapse/setup_install.yml index 429179de..2c6f05b7 100644 --- a/roles/custom/matrix-synapse/tasks/synapse/setup_install.yml +++ b/roles/custom/matrix-synapse/tasks/synapse/setup_install.yml @@ -127,17 +127,11 @@ src: "{{ role_path }}/templates/synapse/systemd/matrix-synapse.service.j2" dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-synapse.service" mode: 0644 - register: matrix_synapse_systemd_service_result -- name: Ensure systemd reloaded after matrix-synapse.service installation - ansible.builtin.service: - daemon_reload: true - when: "matrix_synapse_systemd_service_result.changed" - -- name: Ensure matrix-synapse-register-user script created +- name: Ensure register-user script created ansible.builtin.template: - src: "{{ role_path }}/templates/synapse/usr-local-bin/matrix-synapse-register-user.j2" - dest: "{{ matrix_local_bin_path }}/matrix-synapse-register-user" + src: "{{ role_path }}/templates/synapse/bin/register-user.j2" + dest: "{{ matrix_synapse_bin_path }}/register-user" mode: 0755 - name: Generate sample prometheus.yml for external scraping diff --git a/roles/custom/matrix-synapse/templates/synapse/usr-local-bin/matrix-synapse-register-user.j2 b/roles/custom/matrix-synapse/templates/synapse/bin/register-user.j2 similarity index 100% rename from roles/custom/matrix-synapse/templates/synapse/usr-local-bin/matrix-synapse-register-user.j2 rename to roles/custom/matrix-synapse/templates/synapse/bin/register-user.j2