From ea189822fc464a05f842c8975595ba99d97b7c38 Mon Sep 17 00:00:00 2001 From: Markus Hauschild Date: Sat, 5 Oct 2024 19:39:26 +0200 Subject: [PATCH] repalce dhcpd by kea --- roles/dhcpd/handlers/main.yml | 4 - roles/dhcpd/tasks/main.yml | 14 - .../templates/default/isc-dhcp-server.j2 | 21 -- roles/dhcpd/templates/dhcp/dhcpd.conf.j2 | 319 ------------------ site.yml | 2 +- 5 files changed, 1 insertion(+), 359 deletions(-) delete mode 100644 roles/dhcpd/handlers/main.yml delete mode 100644 roles/dhcpd/tasks/main.yml delete mode 100644 roles/dhcpd/templates/default/isc-dhcp-server.j2 delete mode 100644 roles/dhcpd/templates/dhcp/dhcpd.conf.j2 diff --git a/roles/dhcpd/handlers/main.yml b/roles/dhcpd/handlers/main.yml deleted file mode 100644 index 6384943..0000000 --- a/roles/dhcpd/handlers/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- - -- name: Restart isc-dhcp-server - service: name=isc-dhcp-server state=restarted diff --git a/roles/dhcpd/tasks/main.yml b/roles/dhcpd/tasks/main.yml deleted file mode 100644 index c29b3a1..0000000 --- a/roles/dhcpd/tasks/main.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- - -- name: Install dhcp server - apt: name=isc-dhcp-server - -- name: Configure dhcp server - template: src={{ item }}.j2 dest=/etc/{{ item }} - with_items: - - default/isc-dhcp-server - - dhcp/dhcpd.conf - notify: Restart isc-dhcp-server - -- name: Start the dhcp server - service: name=isc-dhcp-server state=started enabled=yes diff --git a/roles/dhcpd/templates/default/isc-dhcp-server.j2 b/roles/dhcpd/templates/default/isc-dhcp-server.j2 deleted file mode 100644 index fc9997d..0000000 --- a/roles/dhcpd/templates/default/isc-dhcp-server.j2 +++ /dev/null @@ -1,21 +0,0 @@ -# -# This is a POSIX shell fragment -# - -# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf). -#DHCPDv4_CONF=/etc/dhcp/dhcpd.conf -#DHCPDv6_CONF=/etc/dhcp/dhcpd6.conf - -# Path to dhcpd's PID file (default: /var/run/dhcpd.pid). -#DHCPDv4_PID=/var/run/dhcpd.pid -#DHCPDv6_PID=/var/run/dhcpd6.pid - -# Additional options to start dhcpd with. -# Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead -#OPTIONS="" - -# On what interfaces should the DHCP server (dhcpd) serve DHCP requests? -# Separate multiple interfaces with spaces, e.g. "eth0 eth1". -INTERFACESv4="{{ ansible_default_ipv4['interface'] }}" -INTERFACESv6="" -INTERFACES="{{ ansible_default_ipv4['interface'] }}" diff --git a/roles/dhcpd/templates/dhcp/dhcpd.conf.j2 b/roles/dhcpd/templates/dhcp/dhcpd.conf.j2 deleted file mode 100644 index 0ff0743..0000000 --- a/roles/dhcpd/templates/dhcp/dhcpd.conf.j2 +++ /dev/null @@ -1,319 +0,0 @@ -# dhcpd.conf - -# option definitions common to all supported networks... -option domain-name "binary.kitchen"; -option domain-name-servers {{ name_servers | join(', ') }}; -option domain-search "binary.kitchen"; -option ntp-servers 172.23.1.60, 172.23.2.3; - -# options related to Mitel SIP-DECT -option space sipdect; -option local-encapsulation code 43 = encapsulate sipdect; -option sipdect.ommip1 code 10 = ip-address; -option sipdect.ommip2 code 19 = ip-address; -option sipdect.syslogip code 14 = ip-address; -option sipdect.syslogport code 15 = integer 16; -option magic_str code 224 = text; - -default-lease-time 7200; -max-lease-time 28800; - -# Use this to enble / disable dynamic dns updates globally. -ddns-update-style interim; -ddns-updates on; - -# If this DHCP server is the official DHCP server for the local -# network, the authoritative directive should be uncommented. -authoritative; - -# Use this to send dhcp log messages to a different log file (you also -# have to hack syslog.conf to complete the redirection). -log-facility local7; - -{% if dhcpd_failover == true %} - -# Failover - -failover peer "failover-partner" { -{% if ansible_default_ipv4.address == dhcpd_primary %} - primary; - address {{ dhcpd_primary }}; - peer address {{ dhcpd_secondary }}; -{% elif ansible_default_ipv4.address == dhcpd_secondary %} - secondary; - address {{ dhcpd_secondary }}; - peer address {{ dhcpd_primary }}; -{% endif %} - port 520; - peer port 520; - max-response-delay 60; - max-unacked-updates 10; -{% if ansible_default_ipv4.address == dhcpd_primary %} - mclt 600; - split 255; -{% endif %} - load balance max seconds 3; -} -{% endif %} - -# Binary Kitchen subnets - -# Management -subnet 172.23.1.0 netmask 255.255.255.0 { - option routers 172.23.1.1; -} - -# Services -subnet 172.23.2.0 netmask 255.255.255.0 { - allow bootp; - option routers 172.23.2.1; -} - -# Users -subnet 172.23.3.0 netmask 255.255.255.0 { - option routers 172.23.3.1; - ddns-domainname "users.binary.kitchen"; - option domain-search "binary.kitchen", "users.binary.kitchen"; - pool { -{% if dhcpd_failover == true %} - failover peer "failover-partner"; -{% endif %} - range 172.23.3.10 172.23.3.230; - } -} - -# MQTT -subnet 172.23.4.0 netmask 255.255.255.0 { - option routers 172.23.4.1; - pool { -{% if dhcpd_failover == true %} - failover peer "failover-partner"; -{% endif %} - range 172.23.4.10 172.23.4.240; - } -} - -# Management Auweg -subnet 172.23.12.0 netmask 255.255.255.0 { - option routers 172.23.12.1; -} - -# Services Auweg -subnet 172.23.13.0 netmask 255.255.255.0 { - allow bootp; - option routers 172.23.13.1; -} - -# Users Auweg -subnet 172.23.14.0 netmask 255.255.255.0 { - option routers 172.23.14.1; - option domain-search "binary.kitchen", "users.binary.kitchen"; - pool { -{% if dhcpd_failover == true %} - failover peer "failover-partner"; -{% endif %} - range 172.23.14.10 172.23.14.230; - } -} - -# MQTT Auweg -subnet 172.23.15.0 netmask 255.255.255.0 { - option routers 172.23.15.1; - pool { -{% if dhcpd_failover == true %} - failover peer "failover-partner"; -{% endif %} - range 172.23.15.10 172.23.15.240; - } -} - -# DDNS zones - -zone users.binary.kitchen { - primary {{ dns_primary }}; -} - - -# Fixed IPs - -host ap01 { - hardware ethernet 44:48:c1:ce:a9:00; - fixed-address ap01.binary.kitchen; -} - -host ap04 { - hardware ethernet 74:9e:75:ce:93:54; - fixed-address ap04.binary.kitchen; -} - -host ap05 { - hardware ethernet bc:9f:e4:c3:6f:aa; - fixed-address ap05.binary.kitchen; -} - -host ap06 { - hardware ethernet 94:b4:0f:c0:1d:a0; - fixed-address ap06.binary.kitchen; -} - -host ap11 { - hardware ethernet 18:64:72:c6:c2:0c; - fixed-address ap11.binary.kitchen; -} - -host ap12 { - hardware ethernet 18:64:72:c6:c4:98; - fixed-address ap12.binary.kitchen; -} - -host bowle { - hardware ethernet ac:1f:6b:25:16:b6; - fixed-address bowle.binary.kitchen; -} - -host cannelloni { - hardware ethernet b8:27:eb:18:5c:11; - fixed-address cannelloni.binary.kitchen; -} - -host fusilli { - hardware ethernet b8:27:eb:1d:b9:bf; - fixed-address fusilli.binary.kitchen; -} - -host habdisplay1 { - hardware ethernet b8:27:eb:b6:62:be; - fixed-address habdisplay1.mqtt.binary.kitchen; -} - -host habdisplay2 { - hardware ethernet b8:27:eb:df:0b:7b; - fixed-address habdisplay2.mqtt.binary.kitchen; -} - -host klopi { - hardware ethernet 74:da:38:6e:e6:9d; - fixed-address klopi.binary.kitchen; -} - -host lock { - hardware ethernet b8:27:eb:d8:b9:ad; - fixed-address lock.binary.kitchen; -} - -host maccaroni { - hardware ethernet b8:27:eb:f5:9e:a1; - fixed-address maccaroni.binary.kitchen; -} - -host matrix { - hardware ethernet b8:27:eb:ed:22:58; - fixed-address matrix.binary.kitchen; -} - -host mirror { - hardware ethernet 74:da:38:7d:ed:84; - fixed-address mirror.binary.kitchen; -} - -host mpcnc { - hardware ethernet b8:27:eb:0f:d3:8b; - fixed-address mpcnc.binary.kitchen; -} - -host noodlehub { - hardware ethernet b8:27:eb:56:2b:7c; - fixed-address noodlehub.binary.kitchen; -} - -host openhabgw1 { - hardware ethernet dc:a6:32:bf:e2:3e; - fixed-address openhabgw1.mqtt.binary.kitchen; -} - -host pizza { - hardware ethernet 52:54:00:17:02:21; - fixed-address pizza.binary.kitchen; -} - -host spaghetti { - hardware ethernet b8:27:eb:eb:e5:88; - fixed-address spaghetti.binary.kitchen; -} - -host schweinshaxn { - hardware ethernet 52:54:00:17:02:24; - fixed-address schweinshaxn.binary.kitchen; -} - -host strammermax { - hardware ethernet 08:00:37:B8:55:44; - fixed-address strammermax.binary.kitchen; -} - -host obatzda { - hardware ethernet ec:9a:74:35:35:cf; - fixed-address obatzda.binary.kitchen; -} - - -# VoIP Phones - -host voip01 { - hardware ethernet 00:1D:45:B6:99:2F; - option tftp-server-name "172.23.2.36"; -} - -host voip02 { - hardware ethernet 00:1D:A2:66:B8:3E; - option tftp-server-name "172.23.2.36"; -} - -host voip03 { - hardware ethernet 00:1E:BE:90:FB:DB; - option tftp-server-name "172.23.2.36"; -} - -host voip04 { - hardware ethernet 00:1E:BE:90:FF:06; - option tftp-server-name "172.23.2.36"; -} - - -# Mitel SIP-DECT - -host rfp01 { - hardware ethernet 00:30:42:1B:73:5A; - fixed-address 172.23.1.111; - option host-name "rfp01"; - option sipdect.ommip1 172.23.2.35; - option magic_str = "OpenMobilitySIP-DECT"; -} - -host rfp02 { - hardware ethernet 00:30:42:21:D4:D5; - fixed-address 172.23.1.112; - option host-name "rfp02"; - option sipdect.ommip1 172.23.2.35; - option magic_str = "OpenMobilitySIP-DECT"; -} - -host rfp11 { - hardware ethernet 00:30:42:1B:8B:9B; - fixed-address 172.23.12.111; - option host-name "rfp11"; - option sipdect.ommip1 172.23.2.35; - option magic_str = "OpenMobilitySIP-DECT"; -} - - - -# OMAPI - -omapi-port 7911; -omapi-key omapi_key; - -key omapi_key { - algorithm hmac-md5; - secret {{ dhcp_omapi_key }}; -} diff --git a/site.yml b/site.yml index fe1f123..c236fe9 100644 --- a/site.yml +++ b/site.yml @@ -20,7 +20,7 @@ hosts: [bacon.binary.kitchen, aveta.binary.kitchen, aeron.binary.kitchen] roles: - dns_intern - - dhcpd + - kea - slapd - radius