ansible.posix
ansible.posix copied to clipboard
mount: Support unmounting src
SUMMARY
Currently the module can only unmount path
(aka target or mountpoint). However, at least on Linux, the umount
command can also unmount src
from all locations it was mounted to. Therefore I would like for this module to be able to work with src=/dev/sdXY state=unmounted
(and preferably absent
, too).
ISSUE TYPE
- Feature Idea
COMPONENT NAME
mount
ADDITIONAL INFORMATION
The invocation of umount
for the source is the same as for the target — umount /path/to/either
. You can also specify --target
or --source
before the path to make it unambiguous.
- name: Unmount a partition
ansible.posix.mount:
src: /dev/sda1
state: unmounted
The reason that path=/dev/sda1 state=unmounted
doesn't currently work is because it checks first if the path is mounted. And the source isn't necessarily a target — unless it also is, so the --target
and --source
should be used to make this all work correctly.