ansible-role--rsnapshot/tasks/_validation.yml

35 lines
1.1 KiB
YAML
Raw Permalink Normal View History

2024-07-12 12:35:24 +00:00
---
# validate varible rsnapshot_backup_dir
- name: "Validate rsnapshot_backups structure"
ansible.utils.validate:
data:
rsnapshot_snapshot_root: "{{ rsnapshot_snapshot_root }}"
rsnapshot_backups: "{{ rsnapshot_backups }}"
rsnapshot_backup_scripts: "{{ rsnapshot_backup_scripts }}"
rsnapshot_retains: "{{ rsnapshot_retains }}"
rsnapshot_verbose: "{{ rsnapshot_verbose }}"
rsnapshot_loglevel: "{{ rsnapshot_loglevel }}"
rsnapshot_logfile: "{{ rsnapshot_logfile }}"
rsnapshot_link_dest: "{{ rsnapshot_link_dest }}"
rsnapshot_sync_first: "{{ rsnapshot_sync_first }}"
rsnapshot_numtries: "{{ rsnapshot_numtries }}"
criteria:
- "{{ lookup('file', 'criteria/variables.json') | from_json }}"
engine: ansible.utils.jsonschema
ignore_errors: true
register: result
- name: Print the items that do not satisfy the desired state
ansible.builtin.debug:
msg: "{{ item['message'] }}"
loop: "{{ result['errors'] }}"
loop_control:
label: "{{ item['data_path'] }}"
when: "'errors' in result"
- name: Stop if errors
ansible.builtin.meta: end_host
when: "'errors' in result"
#