-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
Remove fstab features from mount, call new module mount2 #27174
Conversation
@Jmainguy this PR contains more than one new module. Please submit only one new module per pullrequest. For further explanation, please read grouped module documentation |
mount2 just deals with the mount command and will not check fstab. Limitations present in this solution. |
I would consider it the same way we 'install/configure' services and then call handler, in this case, fstab is configuration, mount2 the 'handler' (only if you want to, it seems like a good way but this is not a mandate). |
@Jmainguy could you split into 2 PRs, we normally prefer PR per new module to be able to review in parallel. |
The test
The test
|
I will split this into two PR's to fit the model |
The test
The test
|
Split it out, fstab is now in #27245 |
@AugustusKling @ColOfAbRiX @DavidWittman @EvanK @LinusU @abulimov @adejoux @agaffney @ahtik @Akasurde @azaghal @dankeder @davixx @dougluce @dsummersl @goozbach @groks @jasperla @jhoekx @jsumners @kevensen @lberruti @matze @maxamillion @mcv21 @molekuul @mpdehaan @mulby @natefoo @nibalizer @ovcharenko @pmarkham @pyykkis @risaacson @rosmo @saito-hideki @sfromm @srvg @tdtrask @tmshn @xen0l As a maintainer of a module in the same namespace this new module has been submitted to, your vote counts for shipits. Please review this module and add |
Do we really need to call it 'mount2' ? I suspect that we would maybe need a better way to deprecate 'mount', and I suspect this would create a lot of confusion to people over using 'mount' or 'mount2' |
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
|
||
# (c) 2012, Red Hat, inc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright should be updated (that's a detail)
description: | ||
- Filesystem type. Required when I(state) is C(mounted). | ||
required: false | ||
default: null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would using 'auto' here permit to not specifiy it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would default to 'auto' and not require it, let the command fail if it is not present in fstab (like mount does)
try: | ||
os.makedirs(path) | ||
except (OSError, IOError): | ||
e = get_exception() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we no longer care about 2.4, I think this can be cleaned
- If specifying C(mounted) and the mount point is not present, the mount | ||
point will be created. | ||
required: true | ||
choices: ["mounted", "unmounted"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add 'fstab' option to let user specify a specific fstab file, using the system default otherwise
- If specifying C(mounted) and the mount point is not present, the mount | ||
point will be created. | ||
required: true | ||
choices: ["mounted", "unmounted"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
present/absent could be used here, just to keep it in line with other 'state' fields
As said in #19820 separating mount and fstab makes ansible too verbose : - name: Mount for Access now
mount2:
path: /home
src: UUID=b3e48f45-f933-4c8e-a700-22a159ec9077
fstype: xfs
opts: noatime
state: present
- name: make Mount persistent
fstab:
path: /home
src: UUID=b3e48f45-f933-4c8e-a700-22a159ec9077
fstype: xfs
opts: noatime
state: present vs - name: Mount shared filesystem
mount:
path: /home
src: UUID=b3e48f45-f933-4c8e-a700-22a159ec9077
fstype: xfs
opts: noatime
state: present
fstab: present |
@RainerW only if you force module to always define all parameters, it should be able use existing entries in fstab to avoid this, but it should work both ways. - name: make Mount persistent
fstab:
path: /home
src: UUID=b3e48f45-f933-4c8e-a700-22a159ec9077
fstype: xfs
opts: noatime
state: present
- name: Mount for Access now
mount2: path=/home state=present |
+1
There are simply two "states" at play here |
Any progress on this? |
Thank you very much for your interest in Ansible. Ansible has migrated much of the content into separate repositories to allow for more rapid, independent development. We are closing this issue/PR because this content has been moved to one or more collection repositories.
For further information, please see: |
SUMMARY
ISSUE TYPE
COMPONENT NAME
lib/ansible/modules/system/mount2.py
ANSIBLE VERSION
Latest Devel
ADDITIONAL INFORMATION
See issue #19820 where discussion on splitting module started