Only create certificate destination directories once.
If installing several certs or keys to a target the destination directory creation task is run once for each list item even if it is the same directory every time. This patch filters the list of targets and reduces the list of target directories to a unique list, reducing the number of loop iterations required. Change-Id: I7432463dfa067afed2f46874119378bfdf96639c
This commit is contained in:
parent
deec9f47a2
commit
30b72fcdd9
@ -33,16 +33,16 @@
|
||||
|
||||
- name: Create certificate destination directories
|
||||
file:
|
||||
path: "{{ install.item.dest | dirname }}"
|
||||
path: "{{ install }}"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
loop: "{{ _cert_slurp.results }}"
|
||||
loop: "{{ _cert_slurp.results | map(attribute='item') | map(attribute='dest') | map('dirname') | unique }}"
|
||||
loop_control:
|
||||
loop_var: install
|
||||
label: "{{ loop_label | to_json }}"
|
||||
vars:
|
||||
loop_label:
|
||||
path: "{{ install.item.dest | dirname }}"
|
||||
path: "{{ install }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user