From 27678276b25638be02cce21028c45651a1f92985 Mon Sep 17 00:00:00 2001 From: Tatiana Krishtop Date: Fri, 3 Jan 2025 16:23:40 +0100 Subject: [PATCH] Create the logs directory if defined but does not exist --- roles/get_logs_from_namespace/tasks/main.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/roles/get_logs_from_namespace/tasks/main.yml b/roles/get_logs_from_namespace/tasks/main.yml index a206fa55d..ad4209a87 100644 --- a/roles/get_logs_from_namespace/tasks/main.yml +++ b/roles/get_logs_from_namespace/tasks/main.yml @@ -5,14 +5,12 @@ - glfn_ns | string - glfn_oc | string -- name: Check provided logs directory exists - ansible.builtin.stat: +- name: Create the logs directory if defined but does not exist + ansible.builtin.file: path: "{{ glfn_dir }}" - register: dir_stat + state: directory + mode: '0775' when: glfn_dir is defined - failed_when: - - glfn_dir is defined - - not dir_stat.stat.exists - name: Create logs directory when not provided when: glfn_dir is not defined