From 40cf9cd72c0373faccc4eae70165faaafa20393b Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sun, 27 Nov 2022 09:41:03 +0200 Subject: [PATCH] /usr/local/bin/matrix-dendrite-create-account -> /matrix/dendrite/bin/create-account --- roles/custom/matrix-dendrite/defaults/main.yml | 1 + roles/custom/matrix-dendrite/tasks/register_user.yml | 2 +- roles/custom/matrix-dendrite/tasks/setup_install.yml | 9 ++++++--- roles/custom/matrix-dendrite/tasks/setup_uninstall.yml | 7 +++++-- .../create-account.j2} | 0 5 files changed, 13 insertions(+), 6 deletions(-) rename roles/custom/matrix-dendrite/templates/dendrite/{usr-local-bin/matrix-dendrite-create-account.j2 => bin/create-account.j2} (100%) diff --git a/roles/custom/matrix-dendrite/defaults/main.yml b/roles/custom/matrix-dendrite/defaults/main.yml index dac77bc1f..370545187 100644 --- a/roles/custom/matrix-dendrite/defaults/main.yml +++ b/roles/custom/matrix-dendrite/defaults/main.yml @@ -14,6 +14,7 @@ matrix_dendrite_config_dir_path: "{{ matrix_dendrite_base_path }}/config" matrix_dendrite_storage_path: "{{ matrix_dendrite_base_path }}/storage" matrix_dendrite_media_store_path: "{{ matrix_dendrite_storage_path }}/media-store" matrix_dendrite_nats_storage_path: "{{ matrix_dendrite_base_path }}/nats" +matrix_dendrite_bin_path: "{{ matrix_dendrite_base_path }}/bin" matrix_dendrite_ext_path: "{{ matrix_dendrite_base_path }}/ext" # By default, we make Dendrite only serve HTTP (not HTTPS). diff --git a/roles/custom/matrix-dendrite/tasks/register_user.yml b/roles/custom/matrix-dendrite/tasks/register_user.yml index 6b4de7e93..1e2fc100f 100644 --- a/roles/custom/matrix-dendrite/tasks/register_user.yml +++ b/roles/custom/matrix-dendrite/tasks/register_user.yml @@ -29,6 +29,6 @@ - name: Register user ansible.builtin.command: - cmd: "{{ matrix_local_bin_path }}/matrix-dendrite-create-account {{ username | quote }} {{ password | quote }} {{ '1' if admin == 'yes' else '0' }}" + cmd: "{{ {{ matrix_dendrite_bin_path }} }}/create-account {{ username | quote }} {{ password | quote }} {{ '1' if admin == 'yes' else '0' }}" register: matrix_dendrite_register_user_result changed_when: matrix_dendrite_register_user_result.rc == 0 diff --git a/roles/custom/matrix-dendrite/tasks/setup_install.yml b/roles/custom/matrix-dendrite/tasks/setup_install.yml index 1c557e7f7..c516c5b7c 100644 --- a/roles/custom/matrix-dendrite/tasks/setup_install.yml +++ b/roles/custom/matrix-dendrite/tasks/setup_install.yml @@ -9,6 +9,7 @@ group: "{{ matrix_user_groupname }}" with_items: - "{{ matrix_dendrite_config_dir_path }}" + - "{{ matrix_dendrite_bin_path }}" - "{{ matrix_dendrite_ext_path }}" - "{{ matrix_dendrite_nats_storage_path }}" @@ -81,8 +82,10 @@ dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-dendrite.service" mode: 0644 -- name: Ensure matrix-dendrite-create-account script created +- name: Ensure Dendrite scripts created ansible.builtin.template: - src: "{{ role_path }}/templates/dendrite/usr-local-bin/matrix-dendrite-create-account.j2" - dest: "{{ matrix_local_bin_path }}/matrix-dendrite-create-account" + src: "{{ role_path }}/templates/dendrite/bin/{{ item }}.j2" + dest: "{{ matrix_dendrite_bin_path }}/{{ item }}" mode: 0750 + with_items: + - create-account diff --git a/roles/custom/matrix-dendrite/tasks/setup_uninstall.yml b/roles/custom/matrix-dendrite/tasks/setup_uninstall.yml index e5479684c..f6a537b30 100644 --- a/roles/custom/matrix-dendrite/tasks/setup_uninstall.yml +++ b/roles/custom/matrix-dendrite/tasks/setup_uninstall.yml @@ -13,7 +13,10 @@ state: stopped daemon_reload: true - - name: Ensure matrix-dendrite.service doesn't exist + - name: Ensure Dendrite paths don't exist ansible.builtin.file: - path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-dendrite.service" + path: "{{ item }}" state: absent + with_items: + - "{{ devture_systemd_docker_base_systemd_path }}/matrix-dendrite.service" + - "{{ matrix_dendrite_bin_path }}" diff --git a/roles/custom/matrix-dendrite/templates/dendrite/usr-local-bin/matrix-dendrite-create-account.j2 b/roles/custom/matrix-dendrite/templates/dendrite/bin/create-account.j2 similarity index 100% rename from roles/custom/matrix-dendrite/templates/dendrite/usr-local-bin/matrix-dendrite-create-account.j2 rename to roles/custom/matrix-dendrite/templates/dendrite/bin/create-account.j2