Initial gather_ipv4/exportfs build - testing

This commit is contained in:
2025-02-21 18:16:50 -05:00
parent 42f4a94685
commit 769a91ccd1
8 changed files with 111 additions and 16 deletions

13
playbooks/gather_ipv4.yml Normal file
View File

@ -0,0 +1,13 @@
---
- name: Gather IPv4 Addresses
hosts: all
gather_facts: true
become: false
tasks:
- name: Set stats
ansible.builtin.set_stats:
data:
ip_addresses: "{{ ansible_all_ipv4_addresses }}"
server_hostname: "{{ ansible_hostname }}"
aggregate: true

46
playbooks/nfs_export.yml Normal file
View File

@ -0,0 +1,46 @@
---
- name: Check SSH connectivity and create group of reachable hosts
hosts: rear_server
gather_facts: false
become: true
tasks:
- name: Check SSH connectivity
ansible.builtin.ping:
register: result
failed_when: false
- name: Clear unreachable host errors
ansible.builtin.meta: clear_host_errors
- name: Add reachable hosts to group
ansible.builtin.group_by:
key: reachable_hosts
when:
- result['ping'] is defined
- "'pong' in result['ping']"
- name: Update NFS exports on reachable servers
hosts: reachable_hosts
become: true
gather_facts: false
tasks:
- name: Grab the template name
ansible.builtin.set_stats:
data:
nfs_exports_template_name: "{{ tower_job_template_name | default('NA') }}"
aggregate: true
- name: Create IP list and add to NFS exports
when: not rear_backup_skip | default(false) | bool
block:
- name: Create list with IP addresses and hostnames
ansible.builtin.set_fact:
client_ips: "{{ ip_addresses | list | flatten }}"
namehost: "{{ server_hostname }}"
- name: Include NFS export role
ansible.builtin.include_role:
name: ../roles/nfs_export

View File

@ -1,5 +1,5 @@
---
- name: Perform a ReaR backup
- name: ReaR Backup Validation
hosts: all
become: true
gather_facts: true
@ -44,7 +44,7 @@
rescue:
- name: No backup log found
ansible.builtin.debug:
msg: "ReaR backup log could not be found to verify backup status. Please run the backup and try again."
msg: "ReaR backup log could not be found or an error was encountered. Please run the backup and try again."
- name: OS Failure
ansible.builtin.debug: