Files
ansible_samba_ad_dc/tasks/0backupcheck.yml
Jose 6c75e2910b patch undefined: Updated the DNS configuration in the resolv.conf.j2 template to include both the local host and the Ansible-managed DNS server.
Added a new line to the `resolv.conf.j2` template to specify the Ansible-managed DNS server (`{{ addc_ansible_host }}`). This ensures that the system uses both the local host and the managed DNS server for DNS resolution.
2025-10-19 22:25:19 +02:00

57 lines
1.4 KiB
YAML

---
- name: Check if backup directory exists
stat:
path: "{{ backup_path }}"
register: backup_dir_stat
- name: Check if backup directory is not empty
find:
paths: "{{ backup_path }}"
file_type: any
recurse: false
when: backup_dir_stat.stat.exists and backup_dir_stat.stat.isdir
register: backup_dir_contents
- name: Check if each required file exists
stat:
path: "{{ dir_path }}/{{ item }}"
loop: "{{ backup_required_files }}"
register: required_file_stats
- name: Determine missing files
set_fact:
missing_files: >-
{{ required_file_stats.results
| selectattr('stat.exists', 'equalto', false)
| map(attribute='item')
| list }}
- name: Set fact if all required files are present
set_fact:
all_required_files_present: true
when: missing_files | length == 0
- name: Debug - Show status
debug:
msg: >-
{% if all_required_files_present | default(false) %}
All required files are present.
{% else %}
Missing required files: {{ missing_files }}
{% endif %}
- name: Set fact if backup directory exists and is not empty
set_fact:
backup_dir_valid: true
when:
- backup_dir_stat.stat.exists
- backup_dir_stat.stat.isdir
- backup_dir_contents.matched | int > 0
- all_required_files_present
- name: Debug - Show final result
debug:
msg: "Backup directory exists and is not empty."
when: backup_dir_valid | default(false)