diff --git a/deploy.yaml b/deploy.yaml index 67f3518..1e5c4b4 100644 --- a/deploy.yaml +++ b/deploy.yaml @@ -3,3 +3,21 @@ hosts: all roles: - base_config + +- name: Deploy DHCP server + hosts: dhcp + tasks: + - name: deploy kea dhcp server config + ansible.builtin.copy: + src: resources/dhcp/files/kea-dhcp4.conf + dest: /etc/kea/kea-dhcp4.conf + owner: root + group: root + mode: "0644" + notify: Restart Kea DHCP 4 server + + handlers: + - name: Restart Kea DHCP 4 server + ansible.builtin.service: + name: kea-dhcp4-server + state: restarted diff --git a/resources/dhcp/files/kea-dhcp4.conf b/resources/dhcp/files/kea-dhcp4.conf new file mode 100644 index 0000000..3a15002 --- /dev/null +++ b/resources/dhcp/files/kea-dhcp4.conf @@ -0,0 +1,140 @@ +{ +"Dhcp4": { + "interfaces-config": { + "interfaces": [ "eth0" ] + }, + + "control-socket": { + "socket-type": "unix", + "socket-name": "/run/kea/kea4-ctrl-socket" + }, + + "lease-database": { + "type": "memfile", + "lfc-interval": 3600, + "persist": true + }, + + "expired-leases-processing": { + "reclaim-timer-wait-time": 10, + "flush-reclaimed-timer-wait-time": 25, + "hold-reclaimed-time": 3600, + "max-reclaim-leases": 100, + "max-reclaim-time": 250, + "unwarned-reclaim-cycles": 5 + }, + + "calculate-tee-times": true, + "valid-lifetime": 7200, + + "option-data": [ + { + "name": "domain-name-servers", + "code": 6, + "csv-format": true, + "data": "94.45.254.2" + } + ], + + "subnet4": [ + { + // Management + "id": 255, + "option-data": [ + { + "data": "94.45.255.1", + "name": "routers" + } + ], + "pools": [ + { + "pool": "94.45.255.200 - 94.45.255.254" + } + ], + "subnet": "94.45.255.0/24", + }, + { + // Public Wired + "id": 240, + "option-data": [ + { + "data": "94.45.240.1", + "name": "routers" + } + ], + "pools": [ + { + "pool": "94.45.240.20 - 94.45.247.254" + } + ], + "subnet": "94.45.240.0/21" + }, + { + // Public WLAN + "id": 224, + "option-data": [ + { + "data": "94.45.224.1", + "name": "routers" + } + ], + "pools": [ + { + "pool": "94.45.224.20 - 94.45.239.254" + } + ], + "subnet": "94.45.224.0/20" + }, + { + // Public Services reachable event ONLY + "id": 540, + "option-data": [ + { + "data": "94.45.254.1", + "name": "routers" + } + ], + "pools": [ + { + "pool": "94.45.254.100 - 94.45.254.120" + } + ], + "subnet": "94.45.254.0/25" + }, + { + // Public Services reachable EVERYWHERE + "id": 541, + "option-data": [ + { + "data": "94.45.254.128", + "name": "routers" + } + ], + "pools": [ + { + "pool": "94.45.254.220 - 94.45.254.250" + } + ], + "subnet": "94.45.254.128/25" + }, + + ], + + "loggers": [ + { + "name": "kea-dhcp4", + "output_options": [ + { + "output": "stdout", + + "pattern": "%-5p %m\n", + } + ], + + "severity": "INFO", + + "debuglevel": 0 + } + ] +} +}