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

mount boot: false doesn't work on Linux, NetBSD and OpenBSD systems #364

Closed
copyrights opened this issue May 23, 2022 · 1 comment · Fixed by #365
Closed

mount boot: false doesn't work on Linux, NetBSD and OpenBSD systems #364

copyrights opened this issue May 23, 2022 · 1 comment · Fixed by #365

Comments

@copyrights
Copy link

copyrights commented May 23, 2022

SUMMARY

If boot option of mount module is set to false it shall add noauto mount option on Linux, NetBSD and OpenBSD systems.
But there are exceptions. E.g. if defaults in opts

if 'defaults' in opts:

But this is always the case if opts is not set or not on Solaris.
opts='defaults',

Side note: Documentation is misleading as it says opts has no default value. In fact the default value is either "default" or "-".

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • ansible.posix.mount
ANSIBLE VERSION
ansible [core 2.12.5]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/copyrights/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  ansible collection location = /home/copyrights/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.4 (main, Mar 23 2022, 23:05:40) [GCC 11.2.0]
  jinja version = 3.0.3
  libyaml = True
COLLECTION VERSION
# /usr/lib/python3.10/site-packages/ansible_collections
Collection    Version
------------- -------
ansible.posix 1.3.0  
CONFIGURATION

OS / ENVIRONMENT

no relevant

STEPS TO REPRODUCE
---
- name: Mount
  hosts: all
  tasks:
    - name: mount device
      ansible.posix.mount:
        path: /srv/disk
        src: /dev/sdb1
        fstype: ext4
        state: mounted
        boot: false
EXPECTED RESULTS

Device is mounted, but will not be mounted on next boot.

ACTUAL RESULTS

Device is mounted and will be mounted on next boot

@copyrights copyrights changed the title mount boot: false doesn't work on Linux, FreeBSD, NetBSD and OpenBSD systems mount boot: false doesn't work on Linux, NetBSD and OpenBSD systems May 23, 2022
@copyrights
Copy link
Author

I guess the reason for the exception on defaults is that defaults includes auto. from mount(8):

       defaults
           Use the default options: rw, suid, dev, exec, auto, nouser, and async.

           Note that the real set of all default mount options depends on the kernel and filesystem type. See the beginning of this section for more details.

@copyrights copyrights changed the title mount boot: false doesn't work on Linux, NetBSD and OpenBSD systems mount boot: false doesn't work on Linux systems May 23, 2022
@copyrights copyrights changed the title mount boot: false doesn't work on Linux systems mount boot: false doesn't work on Linux, NetBSD and OpenBSD systems May 23, 2022
softwarefactory-project-zuul bot added a commit that referenced this issue Oct 4, 2024
mount: remove boot exception if defaults in opts

SUMMARY

There is no need for an exception on defaults option when adding noauto. Mount is implemented as last win.
from mount(8):
       If you want to override mount options from /etc/fstab, you have to use the -o option:

          mount device|dir -o options

       and then the mount options from the command line will be appended to the list of options from /etc/fstab. This default behaviour can be changed using the --options-mode command-line option. The usual behavior is that the last
       option wins if there are conflicting ones.


Fixes #364
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME


ansible.posix.mount

ADDITIONAL INFORMATION

Reviewed-by: Hideki Saito <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant