Browse Source

Use grains as source for loopback IPs.

  Yes, this is a bit risky currently as newly configured LO-IPs might not be
  set up yet, but this will instantly become a non-issue when the switch to
  ifupdown2 is completed.

Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>
Maximilian Wilhelm 8 years ago
parent
commit
a76f2a1849
1 changed files with 12 additions and 6 deletions
  1. 12 6
      snmpd/snmpd.conf

+ 12 - 6
snmpd/snmpd.conf

@@ -9,15 +9,21 @@ agentAddress  udp:127.0.0.1:161
 agentAddress  udp6:[::1]:161
 
 # Listen for connections on Loopback-IPs
-{%- if globals.LOOPBACK_IPv4 %}
-agentAddress  udp:{{ globals.LOOPBACK_IPv4 }}:161
-{%- endif %}
-{%- if globals.LOOPBACK_IPv6 %}
-agentAddress  udp6:[{{ globals.LOOPBACK_IPv6 }}]:161
-{%- endif %}
+{%- for ipv4 in grains['ipv4'] %}
+  {%- if ipv4.startswith ('131.234.255.') %}
+agentAddress  udp:{{ ipv4 }}:161
+  {%- endif %}
+{%- endfor %}
+{%- for ipv6 in grains['ipv6'] %}
+  {%- if ipv6.startswith ('2a03:2260:2342:ffff:') or ipv6.startswith ('fdca:ffee:ff12:ffff:') %}
+agentAddress  udp6:[{{ ipv6 }}]:161
+  {%- endif %}
+{%- endfor %}
 
 
+rocommunity   {{ ro_community }}	127.0.0.1
 rocommunity   {{ ro_community }}	10.132.251.161
+rocommunity6 {{ ro_community }}	::1
 rocommunity6 {{ ro_community }}	fdca:ffee:ff12:a251::161
 
 sysLocation    {{ globals.SYS_LOCATION }}