rework nfs-host role
This commit is contained in:
parent
3bdd93b16d
commit
ffa3b5d975
4 changed files with 20 additions and 7 deletions
|
@ -1,2 +1,7 @@
|
||||||
---
|
---
|
||||||
|
server_admin: "admin+plumbum@netz39.de"
|
||||||
mac: "32:A3:94:A0:23:77"
|
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
|
|
@ -1,8 +1,8 @@
|
||||||
# Defaults for nfs-host
|
# Defaults for nfs-host
|
||||||
---
|
---
|
||||||
nfs_host_exports:
|
nfs_host_exports: []
|
||||||
- directory: "/srv/nfs"
|
# - directory: "/srv/nfs"
|
||||||
hosts: "k3s-w[0-9]+.n39.eu"
|
# hosts: "k3s-w[0-9]+.n39.eu"
|
||||||
options: rw,sync,no_subtree_check
|
# options: rw,sync,no_subtree_check
|
||||||
|
|
||||||
nfs_host_storage_device: "/dev/sdb"
|
nfs_host_storage_device: "/dev/sdb"
|
3
roles/nfs-host/handlers/main.yml
Normal file
3
roles/nfs-host/handlers/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
- name: reload nfs
|
||||||
|
command: 'exportfs -ra'
|
|
@ -11,8 +11,9 @@
|
||||||
state: present
|
state: present
|
||||||
name:
|
name:
|
||||||
- nfs-kernel-server
|
- nfs-kernel-server
|
||||||
|
- nfs-common
|
||||||
|
|
||||||
- name: ensure nfs mountpoint is present
|
- name: ensure nfs mountpoints exist
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ item.directory }}"
|
path: "{{ item.directory }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
@ -25,4 +26,8 @@
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: templates/exports.j2
|
src: templates/exports.j2
|
||||||
dest: "/etc/exports"
|
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
|
||||||
|
|
Loading…
Reference in a new issue