40 lines
1.2 KiB
YAML
40 lines
1.2 KiB
YAML
---
|
||
# -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 you’re 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
|
||
|
||
vars:
|
||
__nfs_src: 10.10.42.155
|
||
__nfs_share: /exports/shared
|
||
__nfs_mnt_pnt: /nfs/cluster
|
||
|
||
tasks:
|
||
- name: Lazily unmount the NFS share
|
||
ansible.builtin.command: "umount -f -l {{ __nfs_mnt_pnt }}"
|
||
|
||
- name: Reboot host if file changes # noqa: no-handler
|
||
ansible.builtin.import_role:
|
||
name: verified_reboot
|
||
|
||
- 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
|