Add mode option for mount module

This commit is contained in:
satken2 2021-06-13 01:30:51 +09:00
parent 52d040c689
commit dce9f575ff
2 changed files with 44 additions and 0 deletions

View file

@ -0,0 +1,3 @@
---
minor_changes:
- mount - add mode option to mount module (https://github.com/ansible-collections/ansible.posix/issues/163).

View file

@ -332,3 +332,44 @@
- /tmp/myfs.img - /tmp/myfs.img
- /tmp/myfs - /tmp/myfs
when: ansible_system in ('Linux') when: ansible_system in ('Linux')
- name: Block to test mode option in Linux
block:
- name: Create empty file
community.general.filesize:
path: /tmp/myfs.img
size: 20M
- name: Format FS
community.general.filesystem:
fstype: ext3
dev: /tmp/myfs.img
- name: Make sure that mount point does not exist
file:
path: /tmp/myfs
state: absent
- name: Mount the FS to non existent directory with mode option
mount:
path: /tmp/myfs
src: /tmp/myfs.img
fstype: ext3
state: mounted
mode: 0000
- name: Unmount FS to access underlying directory
command: |
umount /tmp/myfs.img
- name: Check status of mount point
stat:
path: /tmp/myfs
register: mount_point_stat
- name: Assert that the mount point has right permission
assert:
that:
- mount_point_stat['stat']['mode'] == '0000'
- name: Remove the test FS
file:
path: '{{ item }}'
state: absent
loop:
- /tmp/myfs.img
- /tmp/myfs
when: ansible_system in ('Linux')