An Ansible Role to install and configure nfs.
NFS is one of the standard tools and used in many environments.
This role installs and configures nfs and nfs exports.
- install nfs packages
- start nfs services
- take care of firewalld (optional)
- create export directories
- configure exports
Used Modules:
- Ansible Package Module
- Ansible Service Module
- Ansible Template Module
- Ansible Firewalld Module
- Ansible package_facts Module
Install from Ansible Galaxy
ansible-galaxy install while_true_do.srv_nfs
Install from Github
git clone https://github.com/while-true-do/ansible-role-srv_nfs.git while_true_do.srv_nfs
---
# defaults file for while_true_do.srv_nfs
## Package Management
# Defaults are based on Fedora
wtd_srv_nfs_package: "nfs-utils"
# State can be present|latest|absent
wtd_srv_nfs_package_state: "present"
### Everything below only applies to role=server.
## Configuration Management
wtd_srv_nfs_conf_exports: []
# - name: "testshare" # will create /etc/exports.d/testshare.exports
# path: "/testshare" # will be created, if not existing
# owner: "nobody" # default: nobody
# group: "nobody" # default: nobody
# mode: "0750" # default: 0750
# hosts:
# - host: "192.168.0.1"
# options: "rw,sync" # default: sync
# - host: "192.168.10.0/24"
## Service Management
wtd_srv_nfs_service: "nfs-server"
# State can be started|stopped
wtd_srv_nfs_service_state: "started"
wtd_srv_nfs_service_enabled: true
## Firewalld Management
wtd_srv_nfs_fw_mgmt: true
wtd_srv_nfs_fw_service: "nfs"
# State can be enabled|disabled
wtd_srv_nfs_fw_state: "enabled"
# Zone can be according to defined zones on your machine.
wtd_srv_nfs_fw_zone: "public"
Running Ansible Roles can be done in a playbook.
---
- hosts: all
roles:
- role: while_true_do.srv_nfs
- hosts: all
roles:
- role: while_true_do.srv_nfs
wtd_srv_nfs_conf_exports:
- name: "nfs"
path: "/var/lib/nfs/"
mode: 0755
hosts:
- host: "192.168.0.1"
- host: "192.168.0.2"
- name: "tftpboot"
path: "/var/lib/tftpboot"
owner: "root"
group: "root"
mode: 0755
hosts:
- hosts: "192.168.0.101"
options: "rw,sync"
- hosts: "192.168.0.102"
- RedHat Testing is currently not possible in public, due to limitations in subscriptions.
- Some services and features cannot be tested properly, due to limitations in docker.
Most of the "generic" tests are located in the Test Library.
Ansible specific testing is done with Molecule.
Infrastructure testing is done with testinfra.
Automated testing is done with Travis CI.
Thank you so much for considering to contribute. We are very happy, when somebody is joining the hard work. Please fell free to open Bugs, Feature Requests or Pull Requests after reading the Contribution Guideline.
See who has contributed already in the kudos.txt.
This work is licensed under a BSD-3-Clause License.
- Site https://while-true-do.io
- Twitter https://twitter.com/wtd_news
- Code https://github.com/while-true-do
- Mail hello@while-true-do.io
- IRC freenode, #while-true-do
- Telegram https://t.me/while_true_do