Browse Source

snmpd: Make sure snmpd starts after network-online.target

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
Maximilian Wilhelm 3 months ago
parent
commit
aa4ba91b58
2 changed files with 11 additions and 4 deletions
  1. 8 4
      snmpd/init.sls
  2. 3 0
      snmpd/service-override.conf

+ 8 - 4
snmpd/init.sls

@@ -4,6 +4,7 @@
 
 include:
   - network
+  - systemd
 
 #
 # Install and start SNMPd
@@ -18,6 +19,13 @@ snmpd:
     - enable: true
     - reload: true
 
+# Add dependecy on network-online.target
+/etc/systemd/system/snmpd.service.d/override.conf:
+  file.managed:
+    - makedirs: true
+    - source: salt://snmpd/service-override.conf
+    - watch_in:
+      - cmd: systemctl-daemon-reload
 
 /etc/default/snmpd:
   file.managed:
@@ -36,7 +44,3 @@ snmpd:
       - pkg: snmpd
     - watch_in:
       - service: snmpd
-
-
-/etc/snmp/ifAlias:
-  file.absent

+ 3 - 0
snmpd/service-override.conf

@@ -0,0 +1,3 @@
+[Unit]
+After=network-online.target
+Wants=network-online.target