Initial gather_ipv4/exportfs build - testing
This commit is contained in:
3
roles/nfs_export/handlers/main.yml
Normal file
3
roles/nfs_export/handlers/main.yml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
- name: Export share
|
||||
ansible.builtin.command: "exportfs -rav"
|
40
roles/nfs_export/tasks/main.yml
Normal file
40
roles/nfs_export/tasks/main.yml
Normal file
@ -0,0 +1,40 @@
|
||||
---
|
||||
- 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))'
|
||||
register: disk_space
|
||||
changed_when: false
|
||||
|
||||
- name: Debug disk_space
|
||||
ansible.builtin.debug:
|
||||
var: disk_space
|
||||
|
||||
- name: Fail job if less than 50GB space
|
||||
ansible.builtin.fail:
|
||||
msg: ReaR NFS server {{ inventory_hostname }} has less than 50GB of space on filesystem."
|
||||
when: (disk_space.stdout|int <= 50)
|
||||
|
||||
- name: Validate IP address fact
|
||||
ansible.builtin.fail:
|
||||
msg: "Missing client_ips variable"
|
||||
when:
|
||||
- client_ips is not defined
|
||||
|
||||
- name: Ensure share directory exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ share }}"
|
||||
state: directory
|
||||
mode: "0777"
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- name: Add remote hosts to /etc/exports
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/exports
|
||||
state: present
|
||||
line: "{{ share }} {{ _options }}"
|
||||
loop: "{{ client_ips | list | flatten }}"
|
||||
vars:
|
||||
_options: "{{ item }}(fsid=0,rw,sync,no_subtree_check,crossmnt)"
|
||||
notify: Export share
|
2
roles/nfs_export/vars/main.yml
Normal file
2
roles/nfs_export/vars/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
share: "/backups/standalone"
|
@ -1,11 +1,2 @@
|
||||
---
|
||||
rear_nfs_srv: "10.10.42.180/backups"
|
||||
|
||||
rear_backup_success_file: /var/log/IPE/IPU/bigboot_success
|
||||
|
||||
# rear_backup_initrd_modules_exclude:
|
||||
# - scsi_debug
|
||||
# - falcon_lsm_serviceable
|
||||
# - falcon_nf_netcontains
|
||||
# - falcon_kal
|
||||
# - falcon_lsm_pinned_16407
|
||||
rear_nfs_srv: "10.10.42.180"
|
||||
|
@ -19,10 +19,10 @@
|
||||
when:
|
||||
- rear_force_backup | default(false) | bool
|
||||
block:
|
||||
- name: Execute ReaR backup
|
||||
ansible.builtin.command: rear -d -v mkbackup
|
||||
changed_when: true
|
||||
register: rear_mkbackup
|
||||
# - name: Execute ReaR backup
|
||||
# ansible.builtin.command: rear -d -v mkbackup
|
||||
# changed_when: true
|
||||
# register: rear_mkbackup
|
||||
|
||||
- name: ReaR backup success
|
||||
ansible.builtin.debug:
|
||||
|
Reference in New Issue
Block a user