From 38b7cea7f8de75af450517911095b374ba185aee Mon Sep 17 00:00:00 2001 From: dbshah12 Date: Tue, 8 Oct 2024 10:11:12 +0530 Subject: [PATCH] DLPX-86539 Update the permissions of the directory only if it exists --- .../roles/delphix-platform/tasks/main.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/files/common/var/lib/delphix-platform/ansible/10-delphix-platform/roles/delphix-platform/tasks/main.yml b/files/common/var/lib/delphix-platform/ansible/10-delphix-platform/roles/delphix-platform/tasks/main.yml index ff90a5d1..fc01a60b 100644 --- a/files/common/var/lib/delphix-platform/ansible/10-delphix-platform/roles/delphix-platform/tasks/main.yml +++ b/files/common/var/lib/delphix-platform/ansible/10-delphix-platform/roles/delphix-platform/tasks/main.yml @@ -739,11 +739,19 @@ state: absent regexp: '^\s*PATH\s*=' -- file: +# Check if the specified directories exist to update the permissions +- stat: path: "{{ item }}" - state: directory - mode: 0750 with_items: - /export/home/delphix - /export/home/cli - /var/lib/postgresql + register: dir_check + +# Update the permissions of the directory only if it exists +- file: + path: "{{ item.stat.path }}" + state: directory + mode: 0750 + when: item.stat.exists + with_items: "{{ dir_check.results }}"