Initial commit

This commit is contained in:
2026-02-21 16:54:18 +01:00
commit 0cf33cd95b
80 changed files with 8042 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
- name: restart dnsmasq
systemd:
name: dnsmasq
state: restarted

View File

@@ -0,0 +1,18 @@
---
- name: Install dnsmasq
apt:
name: dnsmasq
state: present
- name: Create dnsmasq configuration
template:
src: dnsmasq.conf.j2
dest: /etc/dnsmasq.d/{{ gateway_config.lab_name }}.conf
mode: '0644'
notify: restart dnsmasq
- name: Enable and start dnsmasq
systemd:
name: dnsmasq
enabled: yes
state: started

View File

@@ -0,0 +1,28 @@
# {{ gateway_config.lab_name }} DHCP configuration
interface=br-{{ gateway_config.lab_name }}
bind-interfaces
{% if gateway_config.dhcp_role == 'primary' %}
# Primary DHCP server
dhcp-range={{ gateway_config.subnet | ipaddr('10') | ipaddr('address') }},{{ gateway_config.subnet | ipaddr('127') | ipaddr('address') }},{{ gateway_config.subnet | ipaddr('netmask') }},12h
{% elif gateway_config.dhcp_role == 'secondary' %}
# Secondary DHCP server (split range)
dhcp-range={{ gateway_config.subnet | ipaddr('128') | ipaddr('address') }},{{ gateway_config.subnet | ipaddr('245') | ipaddr('address') }},{{ gateway_config.subnet | ipaddr('netmask') }},12h
{% else %}
# Backup server (only responds if others fail)
dhcp-range={{ gateway_config.subnet | ipaddr('10') | ipaddr('address') }},{{ gateway_config.subnet | ipaddr('245') | ipaddr('address') }},{{ gateway_config.subnet | ipaddr('netmask') }},12h
{% endif %}
dhcp-option=option:router,{{ gateway_config.subnet | ipaddr('1') | ipaddr('address') }}
dhcp-option=option:dns-server,{{ gateway_config.subnet | ipaddr('1') | ipaddr('address') }}
# Local DNS domain
domain={{ gateway_config.lab_name }}.lab
local=/{{ gateway_config.lab_name }}.lab/
# Lease file
dhcp-leasefile=/var/lib/misc/dnsmasq.{{ gateway_config.lab_name }}.leases
# Logging
log-dhcp
log-queries