You can use Ansible to automate the configuration of NFS Client Settings
1. Mount an NFS File system, and configure in /etc/fstab
Use state: mounted
- name: Mount NFS Share nfs-server:/usr/local
ansible.posix.mount:
src: nfs-server:/usr_local
path: /usr/local
fstype: nfs
opts: rw,nconnect=16,nfsvers=3,tcp,hard,intr,timeo=600,retrans=2,rsize=524288,wsize=524288
state: mounted
2. Unmount an NFS File System, but not leave /etc/fstab unmodified
Use state: unmounted
- name: Mount NFS Share nfs-server:/usr/local
ansible.posix.mount:
src: nfs-server:/usr_local
path: /usr/local
fstype: nfs
opts: rw,nconnect=16,nfsvers=3,tcp,hard,intr,timeo=600,retrans=2,rsize=524288,wsize=524288
state: unmounted
3. Umount an NFS File System, and remove settings from /etc/fstab
Use state: absent
- name: Mount NFS Share nfs-server:/usr/local
ansible.posix.mount:
src: nfs-server:/usr_local
path: /usr/local
fstype: nfs
opts: rw,nconnect=16,nfsvers=3,tcp,hard,intr,timeo=600,retrans=2,rsize=524288,wsize=524288
state: absent
4. Remount an NFS System, without chaning /etc/fstab
Use state: remounted
- name: Mount NFS Share nfs-server:/usr/local
ansible.posix.mount:
src: nfs-server:/usr_local
path: /usr/local
fstype: nfs
opts: rw,nconnect=16,nfsvers=3,tcp,hard,intr,timeo=600,retrans=2,rsize=524288,wsize=524288
state: remount
References: