From 7bd3b9bb75cf4e00735f75dc99033dda5b81c348 Mon Sep 17 00:00:00 2001 From: rene Date: Thu, 17 Mar 2022 20:41:14 +0100 Subject: [PATCH] switch for snmpd interfaces --- roles/server/tasks/utilities/snmpd.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/roles/server/tasks/utilities/snmpd.yml b/roles/server/tasks/utilities/snmpd.yml index c92c184..8b84b71 100644 --- a/roles/server/tasks/utilities/snmpd.yml +++ b/roles/server/tasks/utilities/snmpd.yml @@ -39,12 +39,21 @@ line: "rouser {{snmp_user }} authpriv" insertafter: "# SECTION: custom settings" -- name: server | snmpd | enable service on all interfaces +- name: server | snmpd | enable service on wireguard interface lineinfile: path: "/etc/snmp/snmpd.conf" regexp: "^agentaddress.*$" state: present line: "agentaddress 127.0.0.1,{{ wg_local_ip | ipaddr('address') }},[::1]" + when: wg_local_ip is defined + +- name: server | snmpd | enable service on all interfaces + lineinfile: + path: "/etc/snmp/snmpd.conf" + regexp: "^agentaddress.*$" + state: present + line: "agentaddress udp:161,udp6:[::1]:161" + when: wg_local_ip is not defined - name: server | snmpd start service service: