From: Kristof Provost Date: Mon, 29 Apr 2024 20:36:10 +0000 (+0200) Subject: router: install & enable isc-dhcpd X-Git-Url: https://git.sigsegv.be/?a=commitdiff_plain;h=f7c1930152df616ed4258748617ea3ee3563381c;p=pennestraat-domotica router: install & enable isc-dhcpd --- diff --git a/ansible/roles/router/tasks/dhcpd.yaml b/ansible/roles/router/tasks/dhcpd.yaml new file mode 100644 index 0000000..6cec1c9 --- /dev/null +++ b/ansible/roles/router/tasks/dhcpd.yaml @@ -0,0 +1,34 @@ +- name: Install isc-dhcpd + community.general.pkgng: + name: isc-dhcp44-server + state: present + become: true +- name: install dhcpd.conf + template: + src: dhcpd-{{ hostname }}.conf + dest: /usr/local/etc/dhcpd.conf + owner: root + group: wheel + mode: 0644 + become: true +- name: dhcpd enable + community.general.sysrc: + name: dhcpd_enable + value: "YES" +- name: dhcpd flags + community.general.sysrc: + name: dhcpd_flags + value: "-q" +- name: dhcpd conf + community.general.sysrc: + name: dhcpd_conf + value: "/usr/local/etc/dhcpd.conf" +- name: dhcpd ifaces + community.general.sysrc: + name: dhcpd_ifaces + value: "igb1" +- name: Start dhcpd + ansible.builtin.service: + name: isc-dhcpd + state: started + become: true diff --git a/ansible/roles/router/tasks/main.yaml b/ansible/roles/router/tasks/main.yaml index 03abcb8..599fd5d 100644 --- a/ansible/roles/router/tasks/main.yaml +++ b/ansible/roles/router/tasks/main.yaml @@ -34,4 +34,5 @@ import_tasks: dyndns.yaml - name: bacula-fd import_tasks: bacula-fd.yaml - +- name: dhcpd + import_tasks: dhcpd.yaml diff --git a/ansible/roles/router/templates/dhcpd-iapetus.saturn.sigsegv.be.conf b/ansible/roles/router/templates/dhcpd-iapetus.saturn.sigsegv.be.conf new file mode 100644 index 0000000..1748dfd --- /dev/null +++ b/ansible/roles/router/templates/dhcpd-iapetus.saturn.sigsegv.be.conf @@ -0,0 +1,60 @@ +# dhcpd.conf +# + +# option definitions common to all supported networks... +option domain-name "saturn.sigsegv.be"; +option domain-name-servers 10.0.1.1; + +option custom-lan-0 code 43 = string; + +default-lease-time 6000; +max-lease-time 7200; + +# Use this to enble / disable dynamic dns updates globally. +#ddns-update-style none; + +# 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; + +# No service will be given on this subnet, but declaring it helps the +# DHCP server to understand the network topology. + +subnet 10.0.1.0 netmask 255.255.255.0 { + range 10.0.1.10 10.0.1.200; + option routers 10.0.1.1; + option custom-lan-0 01:04:AC:10:03:04; +} + +host unifi { + hardware ethernet b4:fb:e4:e4:4b:31; + fixed-address 10.0.1.3; +} +host plc { + hardware ethernet 00:0e:8c:f8:10:fa; + fixed-address 10.0.1.6; +} +host printer { + hardware ethernet 08:00:37:41:22:da; + fixed-address 10.0.1.7; +} +host walter-pc { + hardware ethernet f8:b1:56:cc:35:72; + fixed-address 10.0.1.70; +} +host laptop-walter { + hardware ethernet 00:0f:1f:b5:07:cd; + fixed-address 10.0.1.100; +} +host tuttle-wire { + hardware ethernet 00:25:64:74:e8:ef; + fixed-address 10.0.1.102; +} +host tuttle { + hardware ethernet 00:24:d6:75:74:90; + fixed-address 10.0.1.103; +}