From a3e931188fb91cf8fe2254d350783a3573802cf0 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Sat, 22 Feb 2025 07:00:34 -0500 Subject: [PATCH] Add stuffs --- playbooks/nfs_export.yml | 2 +- roles/nfs_export/tasks/main.yml | 11 ++++++++--- roles/nfs_export/vars/main.yml | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/playbooks/nfs_export.yml b/playbooks/nfs_export.yml index c5c0c68..0f35c8c 100644 --- a/playbooks/nfs_export.yml +++ b/playbooks/nfs_export.yml @@ -24,7 +24,7 @@ - name: Update NFS exports on reachable servers hosts: reachable_hosts become: true - gather_facts: false + gather_facts: true tasks: - name: Grab the template name diff --git a/roles/nfs_export/tasks/main.yml b/roles/nfs_export/tasks/main.yml index 3786849..9d21b3c 100644 --- a/roles/nfs_export/tasks/main.yml +++ b/roles/nfs_export/tasks/main.yml @@ -1,16 +1,21 @@ --- - name: Ensure share directory exists ansible.builtin.file: - path: "{{ share }}" + path: "{{ rear_nfs_export_share }}" 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: Check disk space on ReaR Backup filesystem for NFS servers ansible.builtin.shell: | set -o pipefail - df -BG {{ share }} | tail -1 | awk '{print substr($4, 1, length($4)-1)}' + df -BG {{ rear_nfs_export_share }} | tail -1 | awk '{print substr($4, 1, length($4)-1)}' register: disk_space changed_when: false @@ -33,7 +38,7 @@ ansible.builtin.lineinfile: path: /etc/exports state: present - line: "{{ share }} {{ _options }}" + line: "{{ rear_nfs_export_share }} {{ _options }}" loop: "{{ client_ips | list | flatten }}" vars: _options: "{{ item }}(fsid=0,rw,sync,no_subtree_check,crossmnt)" diff --git a/roles/nfs_export/vars/main.yml b/roles/nfs_export/vars/main.yml index 1f2c20a..afa6dd6 100644 --- a/roles/nfs_export/vars/main.yml +++ b/roles/nfs_export/vars/main.yml @@ -1,2 +1,2 @@ --- -share: "/backups/standalone" +rear_nfs_export_share: "/backups/standalone"