ansible.posix icon indicating copy to clipboard operation
ansible.posix copied to clipboard

Add option to not remove mountpoint

Open Caligatio opened this issue 2 years ago • 3 comments

SUMMARY

It would be useful to add the option to preserve the mountpoint directory when the state is set to absent.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

ansible.posix.mount (plugins/modules/mount.py)

ADDITIONAL INFORMATION

I use network mounts over certain directories that varies from host to host. Nearly every time I specify the state as absent, it's because I want to ensure that a host is using the native filesystem rather than a network share. I want the underlying directory to still exist and rather not have to use a file task.

EDIT: I'm happy to do a PR don't have a good name for the option. It could also double as a flag to not have this task create directories needed for the mount.

Caligatio avatar Mar 09 '22 19:03 Caligatio

@Caligatio thank you for the feature request. I can't think of any good name for this option, but I agree with this request :)

saito-hideki avatar Mar 11 '22 06:03 saito-hideki

Hello. What about a boolean preserve_mountpoint, default to False so it keeps the actual behavior by default?

I could do a PR for this. @saito-hideki , do you know if there is any work in progress regarding this issue?

NeodymiumFerBore avatar Apr 25 '22 06:04 NeodymiumFerBore

Despite my best intentions, I personally haven't started on it yet. It's ultimately implementers choice but manage_mointpoint might be worth considering as it could be used for both creation and deletion.

Caligatio avatar Apr 25 '22 10:04 Caligatio