Add a Systemd dependency for the isc-dhcp-server.service.
authorMatt Birkholz <matt@birchwood-abbey.net>
Mon, 2 Sep 2024 23:16:47 +0000 (17:16 -0600)
committerMatt Birkholz <matt@birchwood-abbey.net>
Mon, 2 Sep 2024 23:16:47 +0000 (17:16 -0600)
This old daemon is still started by the SysV init compatibility layer?
It would occasionally start and find no IP address for the wifi
interface.

README.org
roles_t/gate/handlers/main.yml
roles_t/gate/tasks/main.yml

index 04555f749b629b83a3c2515c0d9479611a639ee0..7a0e635d9feed6698e649d52d71ea44941209a3b 100644 (file)
@@ -4938,7 +4938,10 @@ If physically moved or rebooted for some other reason, the above
 command would not be necessary.
 
 Installation and configuration of the DHCP daemon follows.  Note that
-the daemon listens /only/ on the Gate-WiFi network interface.
+the daemon listens /only/ on the Gate-WiFi network interface.  Also
+note the drop-in ~Requires~ dependency, without which the DHCP server
+intermittently fails, finding the ~wifi~ interface has no IPv4
+addresses (or perhaps finding no ~wifi~ interface at all?).
 
 #+CAPTION: [[file:roles_t/gate/tasks/main.yml][=roles_t/gate/tasks/main.yml=]]
 #+BEGIN_SRC conf :tangle roles_t/gate/tasks/main.yml
@@ -4955,6 +4958,15 @@ the daemon listens /only/ on the Gate-WiFi network interface.
     regexp: ^INTERFACESv4=
   notify: Restart DHCP server.
 
+- name: Configure DHCP server dependence on interface.
+  become: yes
+  copy:
+    content: |
+      [Unit]
+      Requires=network-online.target
+    dest: /etc/systemd/system/isc-dhcp-server.service.d/depend.conf
+  notify: Reload Systemd.
+
 - name: Configure DHCP for WiFiAP service.
   become: yes
   copy:
@@ -4993,6 +5005,11 @@ the daemon listens /only/ on the Gate-WiFi network interface.
   systemd:
     service: isc-dhcp-server
     state: restarted
+
+- name: Reload Systemd.
+  become: yes
+  systemd:
+    daemon-reload: yes
 #+END_SRC
 
 ** Install Server Certificate
index 912186050a9edbfd7eb731b620c4c95ce2e16208..a65da2537b2905f80196d7ffdc0753f47dba16cb 100644 (file)
@@ -9,6 +9,11 @@
     service: isc-dhcp-server
     state: restarted
 
+- name: Reload Systemd.
+  become: yes
+  systemd:
+    daemon-reload: yes
+
 - name: Restart OpenVPN.
   become: yes
   systemd:
index d9cf6787922f3a57afe5106540dde0fce18ea770..66bf06db9aa5d9a6fd1d6c0b8829bd3e900fc0ef 100644 (file)
     regexp: ^INTERFACESv4=
   notify: Restart DHCP server.
 
+- name: Configure DHCP server dependence on interface.
+  become: yes
+  copy:
+    content: |
+      [Unit]
+      Requires=network-online.target
+    dest: /etc/systemd/system/isc-dhcp-server.service.d/depend.conf
+  notify: Reload Systemd.
+
 - name: Configure DHCP for WiFiAP service.
   become: yes
   copy: