mirror of
https://github.com/Alkatrazz24/Funk-lab.git
synced 2026-07-08 11:14:43 +02:00
feat: initial commit — Ansible roles storage-01/gpu-01 opérationnels
This commit is contained in:
commit
b3fce8af5d
70 changed files with 2688 additions and 0 deletions
7
ansible/roles/nfs_client/defaults/main.yml
Normal file
7
ansible/roles/nfs_client/defaults/main.yml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
nfs_server_ip: 192.168.10.1
|
||||
nfs_server_export: /srv/data/nfs/k8s
|
||||
|
||||
nfs_client_mounts:
|
||||
- local_path: /mnt/nfs
|
||||
remote_export: "{{ nfs_server_export }}"
|
||||
5
ansible/roles/nfs_client/handlers/main.yml
Normal file
5
ansible/roles/nfs_client/handlers/main.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- name: Reload systemd and activate automounts
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: true
|
||||
listen: Reload systemd and activate automounts
|
||||
42
ansible/roles/nfs_client/tasks/main.yml
Normal file
42
ansible/roles/nfs_client/tasks/main.yml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
- name: Install nfs-utils
|
||||
ansible.builtin.dnf:
|
||||
name: nfs-utils
|
||||
state: present
|
||||
|
||||
- name: Create NFS mount points
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.local_path }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
loop: "{{ nfs_client_mounts }}"
|
||||
|
||||
- name: Write NFS entries in fstab (sans monter immédiatement)
|
||||
ansible.posix.mount:
|
||||
src: "{{ nfs_server_ip }}:{{ item.remote_export }}"
|
||||
path: "{{ item.local_path }}"
|
||||
fstype: nfs
|
||||
# Options pour extinctions fréquentes :
|
||||
# soft → échoue proprement (EIO) si serveur injoignable
|
||||
# timeo=30 / retrans=3 → 3s timeout, 3 essais avant EIO
|
||||
# _netdev → montage après réseau disponible seulement
|
||||
# nofail → n'empêche pas le boot si NFS absent
|
||||
# x-systemd.automount → monté à la demande (premier accès), pas au boot
|
||||
# x-systemd.mount-timeout=30 → 30s max pour réussir le montage à la demande
|
||||
opts: "nfsvers=4,soft,timeo=30,retrans=3,_netdev,nofail,x-systemd.automount,x-systemd.mount-timeout=30"
|
||||
state: present
|
||||
dump: 0
|
||||
passno: 0
|
||||
loop: "{{ nfs_client_mounts }}"
|
||||
notify: Reload systemd and activate automounts
|
||||
|
||||
- name: Reload systemd et activer les automounts NFS
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: true
|
||||
|
||||
- name: Enable and start NFS automount units
|
||||
ansible.builtin.systemd:
|
||||
name: "{{ item.local_path | replace('/', '-') | regex_replace('^-', '') }}.automount"
|
||||
enabled: true
|
||||
state: started
|
||||
loop: "{{ nfs_client_mounts }}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue