feat: Add nfs server to host machines

This commit is contained in:
Marty Oehme 2025-10-20 10:47:32 +02:00
parent 2b05fc7363
commit 547ab91972
Signed by: Marty
GPG key ID: 4E535BC19C61886E
5 changed files with 50 additions and 0 deletions

30
roles/nfs/tasks/main.yaml Normal file
View file

@ -0,0 +1,30 @@
---
- name: Install nfs kernel package
ansible.builtin.package:
name: nfs-kernel-server
state: present
become: true
notify: Reload nfs service
- name: Create exports conf file
ansible.builtin.template:
src: exports.jinja
dest: /etc/exports
mode: '0644'
become: true
notify: Reload nfs service
- name: Ensure share directories exist
ansible.builtin.file:
state: directory
# nfs conf lines start with the shared dir
path: "{{ item.split(' ')[0] }}"
become: true
loop: "{{ nfs_export_lines }}"
- name: Enable nfs server unit
ansible.builtin.systemd:
enabled: true
name: nfs-server.service
state: started
become: true