Private
Public Access
2
0
This commit is contained in:
2026-01-20 17:40:16 +03:00
parent cda556eec6
commit b78da80550
83 changed files with 108 additions and 82 deletions

View File

@@ -0,0 +1,9 @@
# Required
nfs_server_exports: []
# - path: <string>
# owner: <int>
# group: <int>
# mode: <string> (default "0750")
# clients:
# - address: <string>
# options: <string> (default "ro")

View File

@@ -0,0 +1,5 @@
- name: Restart NFS-Server
ansible.builtin.service:
name: "nfs-kernel-server"
enabled: true
state: "restarted"

View File

@@ -0,0 +1,36 @@
- name: Installation du serveur NFS
ansible.builtin.apt:
name:
- "nfs-kernel-server"
notify:
- "Restart NFS-Server"
- name: Activation de NFS 4
ansible.builtin.lineinfile:
dest: "/etc/nfs.conf"
regex: "{{ item.regex }}"
line: "{{ item.line }}"
loop:
- regex: "vers3=y"
line: "vers3=n"
- regex: "vers4=y"
line: "vers4=y"
notify:
- "Restart NFS-Server"
- name: Création des répertoires exportés
loop: "{{ nfs_server_exports }}"
ansible.builtin.file:
path: "{{ item.path }}"
state: "directory"
owner: "{{ item.owner }}"
group: "{{ item.group }}"
mode: "{{ item.mode | default('750') }}"
- name: Copie du fichier exports
ansible.builtin.template:
src: "templates/exports"
dest: "/etc/exports"
mode: "0644"
notify:
- "Restart NFS-Server"

View File

@@ -0,0 +1,3 @@
{% for export in nfs_server_exports %}
{{ export.path }}{% for c in export.clients %} {{ c.address }}({{ c.options | default ("ro") }}){% endfor %}
{% endfor %}