homelab/roles/init-nfs/tasks/main.yml

40 lines
705 B
YAML

---
- name: Install NFS server.
apt:
name: nfs-kernel-server
state: present
- name: Create directory to share.
file:
path: /mnt/data
state: directory
mode: '755'
owner: 1000
group: 1000
- name: Create directory structure.
file:
path: /mnt/data/{{ item }}
state: directory
mode: '755'
owner: 1000
group: 1000
loop:
- portainer/data
- podgrab/assets
- podgrab/config
- name: Copy over exports file.
template:
src: exports.j2
dest: /etc/exports
notify:
- export file systems
- restart nfs server
- name: Ensure NFS server is running & enabled.
service:
name: nfs-kernel-server
state: started
enabled: yes