Create subdirectories for logrotate.

This commit is contained in:
2021-11-18 05:53:24 +01:00
parent 913ab2bce4
commit 5351bd8ae3

View File

@@ -59,10 +59,25 @@
- nextcloud - nextcloud
- name: Check logrotate directories - name: Check logrotate directories
debug: var=item stat:
path: "{{ backup_dir }}/{{ item }}"
register: subdirs
with_nested: with_nested:
- ['bookstack', 'kimai', 'semaphore', 'gitea', 'nextcloud'] - ['bookstack', 'kimai', 'semaphore', 'gitea', 'nextcloud']
- ['daily', 'weekly', 'monthly', 'yearly'] - ['daily', 'weekly', 'monthly', 'yearly']
loop_control: loop_control:
label: "{{ item[0] }} {{ item[1] }}" 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 }}"