Ansible Role linuxfabrik.lfops.mount¶
This role installs NFS and CIFS client utilities when necessary and configures mount points in /etc/fstab.
Tags¶
mount
- Installs nfs-utils/cifs on RedHat-Based systems or nfs-common/cifs-utils on Debian-Based systems, creates the corresponding directories for the mount points, alters
/etc/fstabund mounts the volumes. - Triggers: none.
Optional Role Variables¶
mount__mounts__host_var / mount__mounts__group_var
- List of directories containing the mounts to create.
-
Subkeys:
-
path:- Mandatory. Path to the mount point.
- Type: String.
-
src:- Mandatory. Device (or NFS volume, or something else) to be mounted on
path. - Type: String.
- Mandatory. Device (or NFS volume, or something else) to be mounted on
-
fstype:- Mandatory. Filesystem type.
- Type: String.
-
group:- Optional. Group of the mount point directory.
- Type: String.
- Default:
'root'
-
opts:- Optional. Mount options,
man fstab. - Type: String.
- Optional. Mount options,
-
owner:- Optional. Owner of the mount point directory.
- Type: String.
- Default:
'root'
-
state:- Optional. Possible options:
absent,absent_from_fstab,ephemeral,mounted,present,remountedorunmounted. For details, have a look at the ansible.posix.mount module. - Type: String.
- Default:
'mounted'
- Optional. Possible options:
-
-
Type: List of dictionaries.
- Default:
[]
Example:
# optional
mount__mounts__host_var:
- path: '/mnt/nfs/data'
fstype: 'nfs'
src: 'nfs-server.example.com:/path/to/exported/data'
opts: 'defaults'
state: 'mounted'
- path: '/mnt/cifs/data'
fstype: 'cifs'
src: '//cifs-server.example.com/CIFS-Share'
opts: 'username=USERNAME,password=PASSWORD,vers=2.0,rw'
state: 'mounted'
- path: '/data'
fstype: 'xfs'
src: '/dev/sdb1'
owner: 'myuser'
group: 'mygroup'
opts: 'defaults'
state: 'mounted'
Troubleshooting¶
mount.nfs: access denied by server while mounting: Run exportfs -rv on the NFS server and try again.