4.9 KiB
profile::mounter
This module manages mounts and installs filesystem-specific utilities.
Mounts are configured using the Puppet mount resource
type, ie. they get added to /etc/fstab. Auto-mounts are
implemented by adding the x-systemd.automount option.
Parameters
| Name | Type | Default |
|---|---|---|
| mounts | Array | [] |
| def::$NAME | Hash | None |
| cifs_files | Array | [] |
| cifs::def::$NAME | Hash | None |
mounter::def::$NAME
A hash defining a mount $NAME which can then be
referenced by a module or through the Hiera variable
mounter::mounts.
The hash may contain the following keys:
ensure
Is passed to the
mountresource type unaltered with the following exception. If the value isrunning, it is changed tomounted. This ensures compatibility with an older version of this module.mountpoint
Will be created, if necessary.
device
options
type
The filesystem type. Passed to the
mountresource asfstype.auto
Whether or not this mount should be automounted. Default:
false.updatedb
A boolean specifying whether
updatedb(8)should index the files below the mountpoint. See theupdatedb <../components/updatedb>module for details.
mounter::mounts
An array of strings referring to mount definitions to be configured on the target system. Each string is the name of a mount defined through mounter::def::$NAME.
mounter::cifs::def::$NAME
A Hash containing information for creating an
authentication file for CIFS mounts.
The Hash may contain the following keys:
ensure
Is passwed to the
profile::mounter::cifsresource, should contain any possible value for the attributensurein aFileresource type. Usually,presentwill ensure that file is existing and updated willabsentwill remove it.path
This is mandatory, should contain the path where the new credential file should be located. Usually,
/etc/cifs-utilswould be a good option.mode
Defaults to
0400. It can be changed.owner
Defaults to
rootuser. It can be changed.group
Defaults to
groupuser. It can be changed.cifs_username
Must be defined. Should contain the
usernameof the user allowed to mount the CIFS mountpoint.cifs_password
Must be defined. Should contain the
passwordof the user allowed to mount the CIFS mountpoint, defined withcifs_username.
mounter::cifs
This defined type takes the paremters accepted for CIFS definitions (see mounter::cifs::def::$NAME).
Defined Types
mount
This defined type takes the parameters accepted for mount definitions (see mounter::def::$NAME).
Examples
Local mount
A local mount can be configured in the following way:
mounter::def::scratch:
ensure: 'mounted'
mountpoint: '/scratch'
device: '/dev/vg_data/lv_scratch'
type: 'xfs'
mounter::mounts:
- 'scratch'
To have the scratch mount from the previous example
auto-mounted instead, add the auto parameter:
mounter::def::scratch:
ensure: 'mounted'
mountpoint: '/scratch'
device: '/dev/vg_data/lv_scratch'
type: 'xfs'
auto: true
mounter::mounts:
- 'scratch'
Supposedly this is a scratch mount, so we exclude the whole mount both from backups and from updatedb.
Remote Mount
Remote CIFS mountpoint can be defined as follows:
mounter::cifs::def::cifs_mpc2375:
ensure: 'present'
path: '/etc/cifs-utils'
cifs_username: 'allowedWindowsUser'
cifs_password: 'ENC[PKCS7,MIIBeQYJKoZIhvc...]'
mounter::cifs::files:
- 'cifs_mpc2375'
mounter::def::emf:
ensure: 'running'
enable: 'true'
device: '//172.23.75.16/Users'
mountpoint: '/emf/jeol2200fs/k2'
type: 'cifs'
options: 'credentials=/etc/cifs-utils/cifs_mpc2375,uid=35667,gid=35270,forcegid,file_mode=0660,dir_mode=0770'
mounter::mounts:
- 'emf'
In the above example, we need to create a credentials
file with mounter::cifs::def::$NAME.
This file will be called cifs_mpc2375 and will be located
in /etc/cifs-utils and will contain information about the
username and password allowed to mount it.
On the other hand, a mount emf is defined. You should
specify in options the location of credentials. Other
optional parameters are used. emf is mounted with type
cifs, which will automatically ensure that proper
cifs-utils package is installed.