Files
quick_test/reboot_test3.yml
2025-07-28 16:58:12 -04:00

40 lines
1.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
# -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
vars:
__nfs_src: 10.10.42.180
__nfs_share: /backups
__nfs_mnt_pnt: /nfs/backups
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