This commit is contained in:
2025-03-05 16:44:31 -05:00
parent 8c4ce22fe0
commit 0360927617
5 changed files with 31 additions and 41 deletions

View File

@ -1,27 +1,27 @@
---
- name: Ensure share directory exists
ansible.builtin.file:
path: "{{ rear_vars_nfs_share[rear_backup_workflow]['share'] }}"
path: "{{ rear_vars_nfs_base }}/{{ rear_backup_workflow }}"
state: directory
mode: "0777"
owner: root
group: root
# We should use Ansible to determine disk space, not command/shell:
- name: Debug mounts
ansible.builtin.debug:
var: ansible_facts['mounts']
# - name: Debug mounts
# ansible.builtin.debug:
# var: ansible_facts['mounts']
- name: Check disk space on ReaR Backup filesystem for NFS servers
ansible.builtin.shell: |
set -o pipefail
df -BG {{ rear_vars_nfs_share[rear_backup_workflow]['share'] }} | tail -1 | awk '{print substr($4, 1, length($4)-1)}'
df -BG {{ rear_vars_nfs_base }}/{{ rear_backup_workflow }} | tail -1 | awk '{print substr($4, 1, length($4)-1)}'
register: disk_space
changed_when: false
- name: Debug disk_space
ansible.builtin.debug:
var: disk_space
# - name: Debug disk_space
# ansible.builtin.debug:
# var: disk_space
- name: Fail job if less than 50GB space
ansible.builtin.fail:
@ -38,12 +38,12 @@
ansible.builtin.lineinfile:
path: /etc/exports
state: present
line: "{{ rear_vars_nfs_share[rear_backup_workflow]['share'] }} {{ _options }}"
line: "{{ rear_vars_nfs_base }}/{{ rear_backup_workflow }} {{ _options }}"
create: true
mode: "0644"
owner: root
group: root
loop: "{{ client_ips | list | flatten }}"
vars:
_options: "{{ item }}(fsid={{ rear_vars_nfs_share[rear_backup_workflow]['fsid'] }},rw,sync,no_subtree_check,crossmnt)"
_options: "{{ item }}(fsid={{ rear_vars_nfs_fsid[rear_backup_workflow] }},rw,sync,no_subtree_check,crossmnt)"
notify: Export share