build
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled

This commit is contained in:
2025-10-26 02:20:22 +01:00
parent 1b48c81066
commit d49c209199

63
roles/nfs_server/tasks/main.yml Executable file
View File

@@ -0,0 +1,63 @@
- name: Setup autofs
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"
block:
- name: Include vault
ansible.builtin.include_vars:
file: jaydee.yml
- name: Install nfs-server
ansible.builtin.apt:
name:
- nfs-kernel-server
state: present
- name: Ensure nfsd thread count is set
community.general.ini_file:
path: /etc/nfs.conf
section: nfsd
option: threads
value: "1"
no_extra_spaces: true
mode: '0644'
- name: Mount and bind a volume
ansible.posix.mount:
path: /srv/nfs/downloads
src: /media/m-server/downloads
opts: bind
state: mounted
fstype: none
when: inventory_hostname == 'm-server.home.lan'
- name: Mount and bind a volume
ansible.posix.mount:
path: /srv/nfs/docker_data
src: /share/docker_data
opts: bind
state: mounted
fstype: none
- name: Reconfigure nfs exports
ansible.builtin.lineinfile:
path: /etc/exports
regexp: "^/srv/nfs .*"
line: "/srv/nfs 192.168.77.0/24(rw,sync,no_subtree_check,crossmnt,fsid=0)"
- name: Reconfigure nfs exports
ansible.builtin.lineinfile:
path: /etc/exports
regexp: "^/srv/nfs/docker_data .*"
line: "/srv/nfs/docker_data 192.168.77.0/24(rw,sync,no_subtree_check)"
- name: Reconfigure nfs exports
ansible.builtin.lineinfile:
path: /etc/exports
regexp: "^/srv/nfs/downloads .*"
line: "/srv/nfs/downloads 192.168.77.0/24(rw,sync,no_subtree_check)"
when: inventory_hostname == 'm-server.home.lan'
- name: Restart nfs service
ansible.builtin.service:
name: nfs-server
state: restarted