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: