New in version 2018.3.0.
To ensure an NFS export exists:
add_simple_export:
nfs_export.present:
- name: '/srv/nfs'
- hosts: '10.0.2.0/24'
- options:
- 'rw'
This creates the following in /etc/exports:
/srv/nfs 10.0.2.0/24(rw)
For more complex exports with multiple groups of hosts, use 'clients':
add_complex_export:
nfs_export.present:
- name: '/srv/nfs'
- clients:
# First export, same as simple one above
- hosts: '10.0.2.0/24'
options:
- 'rw'
# Second export
- hosts: '*.example.com'
options:
- 'ro'
- 'subtree_check'
This creates the following in /etc/exports:
/srv/nfs 10.0.2.0/24(rw) 192.168.0.0/24,172.19.0.0/16(ro,subtree_check)
Any export of the given path will be modified to match the one specified.
To ensure an NFS export is absent:
delete_export:
nfs_export.absent:
- name: '/srv/nfs'
Ensure that the named path is not exported
The export path to remove
Ensure that the named export is present with the given options
The export path to configure
A list of hosts and the options applied to them. This option may not be used in combination with the 'hosts' or 'options' shortcuts.
- clients:
# First export
- hosts: '10.0.2.0/24'
options:
- 'rw'
# Second export
- hosts: '*.example.com'
options:
- 'ro'
- 'subtree_check'
A string matching a number of hosts, for example:
hosts: '10.0.2.123'
hosts: '10.0.2.0/24'
hosts: 'minion1.example.com'
hosts: '*.example.com'
hosts: '*'
A list of NFS options, for example:
options:
- 'rw'
- 'subtree_check'