Add a few things; nfs_lazy_reboot2.yml/nfs_lazy_reboot3.yml are valid; v2 is best POC

This commit is contained in:
2025-07-30 16:49:16 -04:00
parent 6bcacd8a97
commit 35476c9b25
11 changed files with 405 additions and 26 deletions

View File

@ -1,20 +1,8 @@
---
# -l, --lazy
# Lazy unmount. Detach the filesystem from the file hierarchy now,
# and clean up all references to this filesystem as soon as it
# is not busy anymore.
# A system reboot would be expected in near future if youre going to use
# this option for network filesystem or local filesystem with submounts.
#
# The recommended use-case for umount -l is to prevent hangs on shutdown
# due to an unreachable network share where a normal umount will hang
# due to a downed server or a network partition. Remounts of the share
# will not be possible.
- name: Something
hosts: temp
become: true
gather_facts: false
gather_facts: true
vars:
__nfs_src: 10.10.42.180
@ -22,18 +10,17 @@
__nfs_mnt_pnt: /nfs/backups
tasks:
- name: Lazily unmount the NFS share
ansible.builtin.command: "umount -f -l {{ __nfs_mnt_pnt }}"
- name: Verify mount status and reboot
block:
- name: Verify mount status
ansible.builtin.command: df
timeout: 5
- name: Reboot host if file changes # noqa: no-handler
ansible.builtin.import_role:
name: verified_reboot
rescue:
- name: Lazily unmount the NFS share
ansible.builtin.command: "umount -f -l {{ __nfs_mnt_pnt }}"
- name: Unlazily re-mount the file system
ansible.posix.mount:
state: mounted
src: "{{ __nfs_src }}:{{ __nfs_share }}"
path: "{{ __nfs_mnt_pnt }}"
opts: rw,noatime
boot: false
fstype: nfs
always:
- name: Reboot host if file changes # noqa: no-handler
ansible.builtin.import_role:
name: verified_reboot