mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2025-10-28 17:10:07 +01:00
This commit is contained in:
63
roles/nfs_server/tasks/main.yml
Executable file
63
roles/nfs_server/tasks/main.yml
Executable 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
|
||||
Reference in New Issue
Block a user