rework nfs-host role

This commit is contained in:
David Kilias 2023-10-09 21:20:51 +02:00 committed by Stefan Haun
parent 3bdd93b16d
commit ffa3b5d975
4 changed files with 20 additions and 7 deletions

View file

@ -1,2 +1,7 @@
---
server_admin: "admin+plumbum@netz39.de"
mac: "32:A3:94:A0:23:77"
nfs_host_exports:
- directory: "/srv/nfs"
hosts: "k3s-w[0-9]+.n39.eu"
options: rw,sync,no_subtree_check

View file

@ -1,8 +1,8 @@
# Defaults for nfs-host
---
nfs_host_exports:
- directory: "/srv/nfs"
hosts: "k3s-w[0-9]+.n39.eu"
options: rw,sync,no_subtree_check
nfs_host_exports: []
# - directory: "/srv/nfs"
# hosts: "k3s-w[0-9]+.n39.eu"
# options: rw,sync,no_subtree_check
nfs_host_storage_device: "/dev/sdb"
nfs_host_storage_device: "/dev/sdb"

View file

@ -0,0 +1,3 @@
---
- name: reload nfs
command: 'exportfs -ra'

View file

@ -11,8 +11,9 @@
state: present
name:
- nfs-kernel-server
- nfs-common
- name: ensure nfs mountpoint is present
- name: ensure nfs mountpoints exist
ansible.builtin.file:
path: "{{ item.directory }}"
state: directory
@ -25,4 +26,8 @@
ansible.builtin.template:
src: templates/exports.j2
dest: "/etc/exports"
# restart nfs server
notify: reload nfs
- name: Ensure nfs is running.
ansible.builtin.service: "name={{ nfs_server_daemon }} state=started enabled=yes"
when: nfs_host_exports|length