Ansible Role nfs_server¶
This role installs and configures NFS as a server.
Mandatory Role Variables¶
nfs_server__exports
List of NFS exports to create.
Type: List of dictionaries.
Subkeys:
path:Mandatory. Directory to export.
Type: String.
clients:Mandatory. List of client specifications. Have a look at
man 5 exports.Type: List.
owner:Optional. Owner of the export directory.
Type: String.
Default:
'nobody'
group:Optional. Group of the export directory.
Type: String.
Default:
'nogroup'('nobody'for RHEL, CentOS, Fedora, Rocky)
mode:Optional. Mode of the export directory.
Type: String.
Default:
'0o755'
Example:
# mandatory
nfs_server__exports:
- path: '/data/dir1'
clients:
- '192.0.2.1(rw,sync,all_squash)'
- '192.0.2.2(ro,sync,all_squash)'
owner: 'root'
group: 'root'
mode: '0o755'
- path: '/data/dir2'
clients:
- '192.0.2.3(ro,sync,all_squash)'
Optional Role Variables¶
nfs_server__service_enabled
Enables or disables the nfs-server service, analogous to
systemctl enable/disable --now.Type: Bool.
Default:
true
Example:
# optional
nfs_server__service_enabled: true