mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-13 08:05:19 +01:00
Compare commits
No commits in common. "284025660c053de08f5607d41550242584bc94aa" and "5ee818ec86771b8523517d0f990094fdf2424601" have entirely different histories.
284025660c
...
5ee818ec86
1 changed files with 2 additions and 19 deletions
|
|
@ -87,8 +87,7 @@ options:
|
||||||
real source. V(absent) does not unmount recursively, and the module will
|
real source. V(absent) does not unmount recursively, and the module will
|
||||||
fail if multiple devices are mounted on the same mount point. Using
|
fail if multiple devices are mounted on the same mount point. Using
|
||||||
V(absent) with a mount point that is not registered in the I(fstab) has
|
V(absent) with a mount point that is not registered in the I(fstab) has
|
||||||
no effect, use V(unmounted) instead. You can set O(keep_mountpoint) to
|
no effect, use V(unmounted) instead.
|
||||||
True to keep the mountpoint.
|
|
||||||
- V(remounted) specifies that the device will be remounted for when you
|
- V(remounted) specifies that the device will be remounted for when you
|
||||||
want to force a refresh on the mount itself (added in 2.9). This will
|
want to force a refresh on the mount itself (added in 2.9). This will
|
||||||
always return RV(ignore:changed=true). If O(opts) is set, the options will be
|
always return RV(ignore:changed=true). If O(opts) is set, the options will be
|
||||||
|
|
@ -133,16 +132,6 @@ options:
|
||||||
the original file back if you somehow clobbered it incorrectly.
|
the original file back if you somehow clobbered it incorrectly.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
keep_mountpoint:
|
|
||||||
description:
|
|
||||||
- Change the default behaviour of state=absent by keeping the mountpoint
|
|
||||||
- With keep_mountpoint=true, state=absent is like unmounted plus the
|
|
||||||
fstab update.
|
|
||||||
- Use it if you care about finding original mountpoint content without failing
|
|
||||||
and want to remove the entry in fstab. If you have no entry to clean in
|
|
||||||
fstab you can use state=unmounted
|
|
||||||
type: bool
|
|
||||||
default: false
|
|
||||||
notes:
|
notes:
|
||||||
- As of Ansible 2.3, the O(name) option has been changed to O(path) as
|
- As of Ansible 2.3, the O(name) option has been changed to O(path) as
|
||||||
default, but O(name) still works as well.
|
default, but O(name) still works as well.
|
||||||
|
|
@ -790,7 +779,6 @@ def main():
|
||||||
src=dict(type='path'),
|
src=dict(type='path'),
|
||||||
backup=dict(type='bool', default=False),
|
backup=dict(type='bool', default=False),
|
||||||
state=dict(type='str', required=True, choices=['absent', 'absent_from_fstab', 'mounted', 'present', 'unmounted', 'remounted', 'ephemeral']),
|
state=dict(type='str', required=True, choices=['absent', 'absent_from_fstab', 'mounted', 'present', 'unmounted', 'remounted', 'ephemeral']),
|
||||||
keep_mountpoint=dict(type='bool', default=False),
|
|
||||||
),
|
),
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
required_if=(
|
required_if=(
|
||||||
|
|
@ -911,11 +899,6 @@ def main():
|
||||||
module.fail_json(
|
module.fail_json(
|
||||||
msg="Error unmounting %s: %s" % (name, msg))
|
msg="Error unmounting %s: %s" % (name, msg))
|
||||||
|
|
||||||
if os.path.exists(name) and module.params['keep_mountpoint'] is False:
|
|
||||||
try:
|
|
||||||
os.rmdir(name)
|
|
||||||
except (OSError, IOError) as e:
|
|
||||||
module.fail_json(msg="Error rmdir %s: %s" % (name, to_native(e)))
|
|
||||||
elif state == 'unmounted':
|
elif state == 'unmounted':
|
||||||
if ismount(name) or is_bind_mounted(module, linux_mounts, name):
|
if ismount(name) or is_bind_mounted(module, linux_mounts, name):
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue