Commit 0c6c4fdf authored by Dan Thomson's avatar Dan Thomson

Fix backup cleanup

parent a8b689e8
Pipeline #15849 canceled with stage
......@@ -79,27 +79,31 @@
rescue:
- name: Put the backups back
copy:
src: "{{ result.backup_file }}"
src: "{{ backup_file }}"
dest: "{{ result.dest }}"
remote_src: true
tags:
- install_config
loop: "{{ update_cfg.results }}"
loop: >
{{ update_cfg.results | selectattr('backup_file', 'defined') |
map(attribute='backup_file') | list }}
loop_control:
loop_var: result
loop_var: backup_file
when:
- "update_cfg is defined"
- "'results' in update_cfg"
always:
- name: Cleanup the backups
file:
path: "{{ result.backup_file }}"
path: "{{ backup_file }}"
state: absent
tags:
- install_config
loop: "{{ update_cfg.results }}"
loop: >
{{ update_cfg.results | selectattr('backup_file', 'defined') |
map(attribute='backup_file') | list }}
loop_control:
loop_var: result
loop_var: backup_file
when:
- "update_cfg is defined"
- "'results' in update_cfg"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment