router: install & enable isc-dhcpd
authorKristof Provost <kp@FreeBSD.org>
Mon, 29 Apr 2024 20:36:10 +0000 (22:36 +0200)
committerKristof Provost <kp@FreeBSD.org>
Mon, 29 Apr 2024 21:40:03 +0000 (23:40 +0200)
ansible/roles/router/tasks/dhcpd.yaml [new file with mode: 0644]
ansible/roles/router/tasks/main.yaml
ansible/roles/router/templates/dhcpd-iapetus.saturn.sigsegv.be.conf [new file with mode: 0644]

diff --git a/ansible/roles/router/tasks/dhcpd.yaml b/ansible/roles/router/tasks/dhcpd.yaml
new file mode 100644 (file)
index 0000000..6cec1c9
--- /dev/null
@@ -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
index 03abcb8..599fd5d 100644 (file)
@@ -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 (file)
index 0000000..1748dfd
--- /dev/null
@@ -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;
+}