Try alternative when creating directories.

This commit is contained in:
2021-11-21 22:12:45 +01:00
parent 7e5d499b0f
commit f6b0086c6c

View File

@@ -13,19 +13,10 @@
path: "{{ backup_dir }}"
state: directory
- name: Check if directories exist
stat:
- name: Check if customer directories exist
file:
path: "{{ backup_dir }}/{{ item.key }}"
register: dirs
state: directory
loop: "{{ lookup('dict', customers) }}"
loop_control:
label: "{{ item.key }}"
- debug: var=dirs
- name: Create not existing directories
debug: var=item.invocation.module_args.path
when: item.stat.exists == false
with_items: "{{ dirs.results }}"
loop_control:
label: "{{ item.item }}"