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.
This commit is contained in:
56
tasks/0backupcheck.yml
Normal file
56
tasks/0backupcheck.yml
Normal file
@@ -0,0 +1,56 @@
|
||||
---
|
||||
- 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)
|
||||
Reference in New Issue
Block a user