From 427d15ce8101688e410efbf86c722dd2f3758a1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian-Samuel=20Geb=C3=BChr?= Date: Mon, 24 Jul 2023 11:35:46 +0200 Subject: [PATCH] Use ansible.builtin.file to clear directory --- .../tasks/clean_cache.yml | 10 +++++++++- .../tasks/setup_install.yml | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/roles/custom/matrix-bot-matrix-registration-bot/tasks/clean_cache.yml b/roles/custom/matrix-bot-matrix-registration-bot/tasks/clean_cache.yml index b9ed8418e..ae4433b8f 100644 --- a/roles/custom/matrix-bot-matrix-registration-bot/tasks/clean_cache.yml +++ b/roles/custom/matrix-bot-matrix-registration-bot/tasks/clean_cache.yml @@ -1,4 +1,12 @@ --- - name: Delete cache files - ansible.builtin.shell: "rm -rf {{ matrix_bot_matrix_registration_bot_data_path }}/*" + ansible.builtin.file: + state: "{{ item }}" + path: "{{ matrix_bot_matrix_registration_bot_data_path }}" + mode: 0750 + owner: "{{ matrix_user_username }}" + group: "{{ matrix_user_groupname }}" + with_items: + - absent + - directory diff --git a/roles/custom/matrix-bot-matrix-registration-bot/tasks/setup_install.yml b/roles/custom/matrix-bot-matrix-registration-bot/tasks/setup_install.yml index 515cd9973..655f3d275 100644 --- a/roles/custom/matrix-bot-matrix-registration-bot/tasks/setup_install.yml +++ b/roles/custom/matrix-bot-matrix-registration-bot/tasks/setup_install.yml @@ -9,7 +9,7 @@ group: "{{ matrix_user_groupname }}" with_items: - {path: "{{ matrix_bot_matrix_registration_bot_config_path }}", when: true} - - - {path: "{{ matrix_bot_matrix_registration_bot_data_path }}", when: true} + - {path: "{{ matrix_bot_matrix_registration_bot_data_path }}", when: true} - {path: "{{ matrix_bot_matrix_registration_bot_docker_src_files_path }}", when: true} when: "item.when | bool"