Optimizations

This commit is contained in:
Chris Hammer 2025-03-03 20:15:51 -05:00
parent 589da360dd
commit 0ff9e4410a
6 changed files with 26 additions and 18 deletions

View File

@ -41,6 +41,12 @@
client_ips: "{{ ip_addresses | list | flatten }}"
namehost: "{{ server_hostname }}"
- name: Import rear_vars role
ansible.builtin.import_role:
name: rhc.rear.rear_vars
- name: Include NFS export role
ansible.builtin.include_role:
name: ../roles/nfs_export
name: rhc.rear.nfs_export
vars:
rear_backup_workflow: standalone

View File

@ -5,21 +5,16 @@
gather_facts: true
strategy: free
vars:
standalone_backup_success_path: "/var/IPE/IPU/el7to8"
standalone_backup_success_file: "{{ standalone_backup_success_path }}/standalone_rear_success"
tasks:
- name: Check for previous backup completion
ansible.builtin.stat:
path: "{{ standalone_backup_success_file }}"
register: standalone_backup_success
path: "{{ rear_backup_success_file_path }}/{{ rear_backup_workflow }}_rear_success"
register: rear_backup_success_file
- name: End if backup has already completed successfully
ansible.builtin.meta: end_host
when:
- standalone_backup_success['stat']['exists'] | bool
- rear_backup_success_file['stat']['exists'] | bool
- not rear_force_backup | default(false) | bool
- name: Perform ReaR Backup and write success log
@ -30,6 +25,8 @@
- name: Include the backup role
ansible.builtin.include_role:
name: rhc.rear.rear_backup
vars:
rear_backup_workflow: standalone
- name: Confirm ReaR backup log is present
ansible.builtin.stat:
@ -55,12 +52,12 @@
- name: Create success file directory if not present
ansible.builtin.file:
path: "{{ standalone_backup_success_path }}"
path: "{{ rear_backup_success_file_path }}"
state: directory
mode: "0755"
- name: Create backup success file
ansible.builtin.copy:
dest: "{{ standalone_backup_success_file }}"
dest: "{{ rear_backup_success_file_path }}/{{ rear_backup_workflow }}_rear_success"
content: "success\n"
mode: "0644"

View File

@ -1,7 +1,7 @@
---
- name: Ensure share directory exists
ansible.builtin.file:
path: "{{ rear_nfs_export_share }}"
path: "{{ rear_vars_nfs_share[rear_backup_workflow]['share'] }}"
state: directory
mode: "0777"
owner: root
@ -15,7 +15,7 @@
- name: Check disk space on ReaR Backup filesystem for NFS servers
ansible.builtin.shell: |
set -o pipefail
df -BG {{ rear_nfs_export_share }} | tail -1 | awk '{print substr($4, 1, length($4)-1)}'
df -BG {{ rear_vars_nfs_share[rear_backup_workflow]['share'] }} | tail -1 | awk '{print substr($4, 1, length($4)-1)}'
register: disk_space
changed_when: false
@ -38,12 +38,12 @@
ansible.builtin.lineinfile:
path: /etc/exports
state: present
line: "{{ rear_nfs_export_share }} {{ _options }}"
line: "{{ rear_vars_nfs_share[rear_backup_workflow]['share'] }} {{ _options }}"
create: true
mode: "0644"
owner: root
group: root
loop: "{{ client_ips | list | flatten }}"
vars:
_options: "{{ item }}(fsid={{ rear_nfs_export_fsid }},rw,sync,no_subtree_check,crossmnt)"
_options: "{{ item }}(fsid={{ rear_vars_nfs_share[rear_backup_workflow]['fsid'] }},rw,sync,no_subtree_check,crossmnt)"
notify: Export share

View File

@ -4,7 +4,7 @@
host: "{{ item }}"
port: 2049
timeout: 30
loop: "{{ nfs_np }}"
loop: "{{ rear_vars_nfs_np }}"
ignore_errors: true
register: active_nfs_servers

View File

@ -3,9 +3,9 @@
##############################################
OUTPUT=ISO
OUTPUT_URL=nfs://{{ nfs_srv }}{{ rear_nfs_backup_share }}
OUTPUT_URL=nfs://{{ nfs_srv }}{{ rear_vars_nfs_share[rear_backup_workflow]['share'] }}
BACKUP=NETFS
BACKUP_URL=nfs://{{ nfs_srv }}{{ rear_nfs_backup_share }}
BACKUP_URL=nfs://{{ nfs_srv }}{{ rear_vars_nfs_share[rear_backup_workflow]['share'] }}
# SSH_ROOT_PASSWORD="bob"
USE_STATIC_NETWORKING=yes
CLONES_ALL_USERS_GROUPS=yes

View File

@ -1,4 +1,9 @@
---
# Used by:
# - rear_backup
rear_backup_success_file_path: "/var/IPE/IPU/el7to8"
# Used by:
# - nfs_exports
# - nfs_server_define