--- # -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_share: /nfs/backups tasks: - name: Lazily unmount the NFS share ansible.builtin.command: "umount -f -l {{ __nfs_share }}" - 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: 10.10.42.180:/backups path: /nfs/backups opts: rw,noatime boot: false fstype: nfs # write script to write files until reboot happens # script should write number, sleep 1 second, write number, etc