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

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

Open copyrights opened this issue 2 years ago • 1 comments

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 https://github.com/ansible-collections/ansible.posix/blob/2d3f55caa73559736fdd378a05dd55bba4722fcc/plugins/modules/mount.py#L746 But this is always the case if opts is not set or not on Solaris. https://github.com/ansible-collections/ansible.posix/blob/2d3f55caa73559736fdd378a05dd55bba4722fcc/plugins/modules/mount.py#L707

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 avatar May 23 '22 19:05 copyrights

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 avatar May 23 '22 20:05 copyrights