feat: make nfs exports more configurable

This commit is contained in:
David Kilias 2023-10-09 18:45:38 +02:00 committed by Stefan Haun
parent aa54dcffdc
commit 3bdd93b16d
3 changed files with 11 additions and 6 deletions

View file

@ -1,4 +1,8 @@
# Defaults for nfs-host # Defaults for nfs-host
--- ---
nfs_host_mount_point: "/srv/nfs" 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

@ -14,15 +14,14 @@
- name: ensure nfs mountpoint is present - name: ensure nfs mountpoint is present
ansible.builtin.file: ansible.builtin.file:
path: "{{ nfs_host_mount_point }}" path: "{{ item.directory }}"
state: directory state: directory
owner: nobody owner: nobody
group: nogroup group: nogroup
mode: '0000' mode: '0000'
loop: "{{ nfs_host_exports | dict2items }}"
# modify /etc/exports# - name: template /etc/exports
# echo '/srv/nfs 10.0.0.0/24(rw,sync,no_subtree_check)'
- name: ensure exports file has k3s ips
ansible.builtin.template: ansible.builtin.template:
src: templates/exports.j2 src: templates/exports.j2
dest: "/etc/exports" dest: "/etc/exports"

View file

@ -1 +1,3 @@
{{ nfs_host_mount_point }} k3s-w[0-9]+.n39.eu(rw,sync,no_subtree_check) {% for export in nfs_host_exports %}
{{ export.directory }} {{ export.hosts }}({{ export.options }})
{% endfor %}