salt.states.nfs_export

Management of NFS exports

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'

salt.states.nfs_export.absent(name, exports='/etc/exports')

Ensure that the named path is not exported

name

The export path to remove

salt.states.nfs_export.present(name, clients=None, hosts=None, options=None, exports='/etc/exports')

Ensure that the named export is present with the given options

name

The export path to configure

clients

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'
hosts

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: '*'
options

A list of NFS options, for example:

options:
  - 'rw'
  - 'subtree_check'

© 2021 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltproject.io/en/latest/ref/states/all/salt.states.nfs_export.html