From d72a570783d97d09fa8fe7d9a1ff3fdf81c06db3 Mon Sep 17 00:00:00 2001 From: Sergey Malyuk Date: Wed, 24 Dec 2025 11:28:36 +0300 Subject: [PATCH] fix unidempotent task --- roles/xfs_project_quotas/tasks/main.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/roles/xfs_project_quotas/tasks/main.yml b/roles/xfs_project_quotas/tasks/main.yml index 6fe35c7..21131e6 100644 --- a/roles/xfs_project_quotas/tasks/main.yml +++ b/roles/xfs_project_quotas/tasks/main.yml @@ -6,12 +6,19 @@ update_cache: true cache_valid_time: 3600 -- name: Touch /etc/projects and /etc/projid +- name: Check files loop: - /etc/projects - /etc/projid - ansible.builtin.file: + ansible.builtin.stat: path: "{{ item }}" + register: proj_files + +- name: Create missing files + loop: "{{ proj_files.results }}" + when: not item.stat.exists + ansible.builtin.file: + path: "{{ item.invocation.module_args.path }}" state: touch owner: root group: root