robertdebock.nfsserver

Ansible Role NFS Server

This document explains how to set up exports on an NFS server.

GitHub GitLab Downloads Version
GitHub Badge GitLab Badge Downloads Badge Version Badge

Example Playbook

The following example is from molecule/default/converge.yml and is tested each time changes are made.

---
- name: Converge
  hosts: all
  become: true
  gather_facts: true

  roles:
    - role: robertdebock.nfsserver
      nfsserver_exports:
        - share: /mnt/export
          owner: root
          group: root
          mode: "0755"
          hosts:
            - name: "10.0.0.0/24"
              options:
                - ro
                - no_subtree_check
                - nohide
            - name: "172.16.0.0/24"
              options:
                - rw
                - sync
                - no_wdelay
        - share: /mnt/export2
          owner: root
          group: root
          mode: "0755"
          hosts:
            - name: "10.2.3.0/24"
              options:
                - ro

Before using the NFS role, the machine needs to be prepared. This is done with molecule/default/prepare.yml:

---
- name: Prepare
  hosts: all
  become: true
  gather_facts: false

  roles:
    - role: robertdebock.bootstrap

For a detailed guide, see this explanation and example.

Role Variables

The default variable values are found in defaults/main.yml:

---
# Default values for nfsserver

# You can list exports like this:
# nfsserver_exports:
#   - share: /mnt/export
#     owner: root
#     group: root
#     mode: "0755"
#     hosts:
#       - name: "10.0.0.0/24"
#         options:
#           - ro
#           - no_subtree_check
#           - nohide
nfsserver_exports: []

# Exports file location.
nfsserver_exports_file: /etc/exports

Requirements

State of Used Roles

You can prepare your system differently, but the following roles can be used:

Requirement GitHub GitLab
robertdebock.bootstrap Build Status GitHub Build Status GitLab

Context

This role works with other compatible roles. For more info, check the documentation of these roles.

Here’s an overview of related roles: dependencies

Compatibility

This role has been tested on these container images:

Container Tags
Alpine all
Amazon Candidate
EL 9
Debian all
Fedora all
Ubuntu all

The minimum required Ansible version is 2.12. Tests have been done on:

  • The previous version.
  • The current version.
  • The development version.

If you discover issues, please report them on GitHub.

License

This role is licensed under the Apache-2.0.

Author Information

This role was created by robertdebock.

Consider sponsoring me.

Informazioni sul progetto

Setup exports on an nfs server

Installa
ansible-galaxy install robertdebock.nfsserver
Licenza
apache-2.0
Download
936
Proprietario
I know my way around (Linux) infrastructure, have a passion for automation, Docker, Ansible, Molecule and ci/cd.