mirror of
https://github.com/Alkatrazz24/Funk-lab.git
synced 2026-07-08 10:04:42 +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
16
ansible/roles/dnsmasq/defaults/main.yml
Normal file
16
ansible/roles/dnsmasq/defaults/main.yml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
dns_upstream:
|
||||
- 8.8.8.8
|
||||
- 8.8.4.4
|
||||
|
||||
dns_cluster_hosts:
|
||||
- name: storage-01
|
||||
ip: 192.168.10.1
|
||||
- name: gpu-01
|
||||
ip: 192.168.10.20
|
||||
- name: compute-01
|
||||
ip: 192.168.10.11
|
||||
- name: compute-02
|
||||
ip: 192.168.10.12
|
||||
- name: compute-03
|
||||
ip: 192.168.10.13
|
||||
9
ansible/roles/dnsmasq/handlers/main.yml
Normal file
9
ansible/roles/dnsmasq/handlers/main.yml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
- name: Restart dnsmasq
|
||||
ansible.builtin.systemd:
|
||||
name: dnsmasq
|
||||
state: restarted
|
||||
|
||||
- name: Reload systemd
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: true
|
||||
29
ansible/roles/dnsmasq/tasks/main.yml
Normal file
29
ansible/roles/dnsmasq/tasks/main.yml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
- name: Install dnsmasq
|
||||
ansible.builtin.dnf:
|
||||
name: dnsmasq
|
||||
state: present
|
||||
|
||||
- name: Deploy dnsmasq config
|
||||
ansible.builtin.template:
|
||||
src: dnsmasq.conf.j2
|
||||
dest: /etc/dnsmasq.conf
|
||||
mode: '0644'
|
||||
notify: Restart dnsmasq
|
||||
|
||||
- name: Deploy dnsmasq systemd override (wait for USB ethernet)
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/systemd/system/dnsmasq.service.d/wait-for-network.conf
|
||||
content: |
|
||||
[Unit]
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
mode: '0644'
|
||||
notify: Reload systemd
|
||||
|
||||
- name: Enable and start dnsmasq
|
||||
ansible.builtin.systemd:
|
||||
name: dnsmasq
|
||||
enabled: true
|
||||
daemon_reload: true
|
||||
state: started
|
||||
31
ansible/roles/dnsmasq/templates/dnsmasq.conf.j2
Normal file
31
ansible/roles/dnsmasq/templates/dnsmasq.conf.j2
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Géré par Ansible — ne pas modifier manuellement
|
||||
|
||||
# Écoute uniquement sur le LAN cluster
|
||||
interface={{ lan_interface }}
|
||||
bind-interfaces
|
||||
|
||||
# Domaine local
|
||||
domain={{ dns_domain }}
|
||||
local=/{{ dns_domain }}/
|
||||
expand-hosts
|
||||
|
||||
# Ne pas lire /etc/resolv.conf pour les upstream
|
||||
no-resolv
|
||||
|
||||
# Upstream DNS pour tout ce qui n'est pas lab.local
|
||||
{% for server in dns_upstream %}
|
||||
server={{ server }}
|
||||
{% endfor %}
|
||||
|
||||
# Enregistrements statiques des machines du cluster
|
||||
{% for host in dns_cluster_hosts %}
|
||||
address=/{{ host.name }}.{{ dns_domain }}/{{ host.ip }}
|
||||
address=/{{ host.name }}/{{ host.ip }}
|
||||
{% endfor %}
|
||||
|
||||
# Cache
|
||||
cache-size=1000
|
||||
|
||||
# Logs (désactiver en prod si trop verbeux)
|
||||
log-queries
|
||||
log-facility=/var/log/dnsmasq.log
|
||||
Loading…
Add table
Add a link
Reference in a new issue