From 5351bd8ae319a10159af6080ecca812be8651848 Mon Sep 17 00:00:00 2001 From: Christian Steinle Date: Thu, 18 Nov 2021 05:53:24 +0100 Subject: [PATCH] Create subdirectories for logrotate. --- odroid.yaml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/odroid.yaml b/odroid.yaml index eb891c1..8839648 100644 --- a/odroid.yaml +++ b/odroid.yaml @@ -59,10 +59,25 @@ - nextcloud - name: Check logrotate directories - debug: var=item + stat: + path: "{{ backup_dir }}/{{ item }}" + register: subdirs with_nested: - ['bookstack', 'kimai', 'semaphore', 'gitea', 'nextcloud'] - ['daily', 'weekly', 'monthly', 'yearly'] loop_control: label: "{{ item[0] }} {{ item[1] }}" + + - name: Create not existing logrotate directories + file: + path: "{{ backup_dir }}/{{ item.item }}" + state: directory + mode: 0755 + group: chris + owner: chris + when: item.stat.exists == false + with_items: "{{ subdirs.results }}" + loop_control: + label: "{{ item.item }}" + \ No newline at end of file