From: Matt Birkholz Date: Mon, 2 Sep 2024 23:16:47 +0000 (-0600) Subject: Add a Systemd dependency for the isc-dhcp-server.service. X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=78d0936f9dc88cc6bcf9ff807102170f9c16aeb1;p=Institute Add a Systemd dependency for the isc-dhcp-server.service. 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. --- diff --git a/README.org b/README.org index 04555f7..7a0e635 100644 --- a/README.org +++ b/README.org @@ -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 diff --git a/roles_t/gate/handlers/main.yml b/roles_t/gate/handlers/main.yml index 9121860..a65da25 100644 --- a/roles_t/gate/handlers/main.yml +++ b/roles_t/gate/handlers/main.yml @@ -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: diff --git a/roles_t/gate/tasks/main.yml b/roles_t/gate/tasks/main.yml index d9cf678..66bf06d 100644 --- a/roles_t/gate/tasks/main.yml +++ b/roles_t/gate/tasks/main.yml @@ -112,6 +112,15 @@ 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: