ansible.posix
ansible.posix copied to clipboard
Mount module doesn't permit reusing `none` as mount point
SUMMARY
Ansible expects the mount point specified by path
to be unique, but it's valid for multiple entries to have a mount point of none
on MacOS. This is used to stop volumes from automatically mounting.
ISSUE TYPE
- Bug Report
COMPONENT NAME
mount module
ANSIBLE VERSION
ansible [core 2.12.5]
config file = None
configured module search path = ['/Users/BeansIsFat/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/BeansIsFat/Library/Python/3.8/lib/python/site-packages/ansible
ansible collection location = /Users/BeansIsFat/.ansible/collections:/usr/share/ansible/collections
executable location = /Users/BeansIsFat/Library/Python/3.8/bin/ansible
python version = 3.8.9 (default, Mar 30 2022, 13:51:17) [Clang 13.1.6 (clang-1316.0.21.2.3)]
jinja version = 3.1.2
libyaml = True
COLLECTION VERSION
# /Users/BeansIsFat/Library/Python/3.8/lib/python/site-packages/ansible_collections
Collection Version
------------- -------
ansible.posix 1.3.0
CONFIGURATION
DEFAULT_HOST_LIST(/Users/BeansIsFat/mount/ansible.cfg) = ['/Users/BeansIsFat/mount/inventory']
DEFAULT_ROLES_PATH(/Users/BeansIsFat/mount/ansible.cfg) = ['/Users/BeansIsFat/mount/roles', '/etc/ansible/roles']
INTERPRETER_PYTHON(/Users/BeansIsFat/mount/ansible.cfg) = /usr/bin/python3
OS / ENVIRONMENT
macOS Monterey 12.3.1
STEPS TO REPRODUCE
The following task will only create an fstab entry for the second item in the loop.
---
- name: Stop drives from mounting automatically
hosts: all
tasks:
- name: Update fstab entries
become: yes
mount:
src: "{{ item.src }}"
state: present
path: "{{ item.path }}"
fstype: apfs
opts: rw,noauto
loop:
- { src: UUID=53DCE501-F280-42C5-A579-2804CB08FDAD, path: none }
- { src: UUID=52D02FBE-632B-4EB5-8FAD-EEB9264269B8, path: none }
EXPECTED RESULTS
fstab contents
UUID=53DCE501-F280-42C5-A579-2804CB08FDAD none apfs rw,noauto 0 0
UUID=52D02FBE-632B-4EB5-8FAD-EEB9264269B8 none apfs rw,noauto 0 0
ACTUAL RESULTS
fstab contents
UUID=52D02FBE-632B-4EB5-8FAD-EEB9264269B8 none apfs rw,noauto 0 0
PLAY [Stop drives from mounting automatically] *********************************
TASK [Gathering Facts] *********************************************************
ok: [127.0.0.1]
TASK [Update fstab entries] ****************************************************
changed: [127.0.0.1] => (item={'src': 'UUID=53DCE501-F280-42C5-A579-2804CB08FDAD', 'path': 'none'})
changed: [127.0.0.1] => (item={'src': 'UUID=52D02FBE-632B-4EB5-8FAD-EEB9264269B8', 'path': 'none'})
PLAY RECAP *********************************************************************
127.0.0.1 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0