Loop var fixes

This commit is contained in:
Bradley Bickford 2025-08-25 19:58:44 -04:00
parent 120f3f8a26
commit 07d9637e9b

View File

@ -1,14 +1,16 @@
---
- name: Ensure backup rules contains the necessary fields
ansible.builtin.fail:
msg: "You must define {{ item }} in the backup ruleset"
when: not backup_rules[item] is defined
msg: "You must define {{ backup_rule_checker }} in the backup ruleset"
when: not backup_rules[backup_rule_checker] is defined
loop:
- container_name
- directories_to_backup
- backup_dir
- backup_name_prefix
- max_backups_kept
loop_control:
loop_var: backup_rule_checker
- name: Make sure backup dir exists
ansible.builtin.file:
@ -53,8 +55,10 @@
- name: Remove the files
ansible.builtin.file:
path: "{{ item }}"
path: "{{ old_file_to_delete }}"
state: absent
loop: "{{ oldest_file_paths }}"
loop_control:
loop_var: old_file_to_delete