Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible.posix.mount: add absent_from_fstab option #166

Merged
merged 3 commits into from
Dec 15, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions plugins/modules/mount.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@
if I(opts) is set, and the remount command fails, the module will
error to prevent unexpected mount changes. Try using C(mounted)
instead to work around this issue.
- C(absent_from_fstab) specifies that the device mount's entry will be
removed from I(fstab). This option does not unmount it or delete the
mountpoint.
type: str
required: true
choices: [ absent, mounted, present, unmounted, remounted ]
choices: [ absent, absent_from_fstab, mounted, present, unmounted, remounted ]
fstab:
description:
- File to use instead of C(/etc/fstab).
Expand Down Expand Up @@ -651,7 +654,7 @@ def main():
passno=dict(type='str', no_log=False),
src=dict(type='path'),
backup=dict(type='bool', default=False),
state=dict(type='str', required=True, choices=['absent', 'mounted', 'present', 'unmounted', 'remounted']),
state=dict(type='str', required=True, choices=['absent', 'absent_from_fstab', 'mounted', 'present', 'unmounted', 'remounted']),
),
supports_check_mode=True,
required_if=(
Expand Down Expand Up @@ -734,7 +737,9 @@ def main():
name = module.params['path']
changed = False

if state == 'absent':
if state == 'absent_from_fstab':
name, changed = unset_mount(module, args)
maxamillion marked this conversation as resolved.
Show resolved Hide resolved
elif state == 'absent':
name, changed = unset_mount(module, args)

if changed and not module.check_mode:
Expand Down