Default variable details
Some of debops.nfs default variables have more extensive configuration than
simple strings or lists, here you can find documentation and examples for them.
nfs__shares
The nfs__shares, nfs__group_shares and
nfs__host_shares are list of NFS shares to configure on a host. Each
list element is a YAML dictionary with specific parameters:
pathRequired. Absolute path of a directory where the given NFS share should be mounted. If the directory does not exist, it will be created by the role.
srcRequired. Mount point "source", usually in the form of:
<hostname>:/<share_path>
You can use either DNS names or IP addresses.
NOTE: If you want to use NFSv4 mount points, you need to specify share paths relative to the NFS
rootdirectory configured on the nfs server.stateOptional. If not specified or
mounted, the given NFS share will be added to the/etc/fstabconfiguration file and automatically mounted. Ifpresent, the NFS mount will be added to the/etc/fstabbut its state will not be changed. Ifunmounted, and the NFS share is mounted, it will be unmounted. Ifabsent, the NFS share will be unmounted and its entry will be removed from/etc/fstabconfiguration file.optionsoroptsOptional. A comma-separated string or a YAML list of mount options which should be used with a given NFS share. If not specified, the role will use a set of default options that configure the mount to be a network NFS4 share.
default_optionsOptional, boolean. If present and
False, the role will not add the default options to the custom ones provided by the user, which will allow full control over the configuration. The_netdevoption is always added to ensure that the/etc/fstabconfiguration file remains valid.fstypeOptional. Specify the filesystem type to use for the mount point. By default it's
nfs4.passno,dump,fstabOptional. Additional parameters passed to the Ansible
mountmodule, by default omitted since they are not useful for NFS shares. See the module documentation page for more details.owner,group,modeOptional. Specify UNIX account, group and directory permissions for the mount point of a given NFS share. They will be applied to the directories created by the role when the NFS share is not mounted immediately.
Examples
Mount a NFS4 share with automatic configuration:
nfs__shares:
- path: '/media/nfs/shared'
src: 'nas.example.org:/shared'
Create an automount entry for a NFSv4 share using systemd automount functionality:
nfs__shares:
- path: '/media/nfs/shared'
src: 'nas.example.org:/shared'
opts: [ 'defaults', 'x-systemd.automount', 'x-systemd.idle-timeout=2',
'x-systemd.device-timeout=2', 'x-systemd.mount-timeout=2' ]
# Without this, Ansible tries to mount the share right away which
# results in an error
state: 'present'