fixed snmpd logging verbosity

This commit is contained in:
Ray Lyon
2021-04-24 19:33:25 -04:00
committed by GitHub
parent fb99dafe67
commit 0822221190

View File

@@ -1,8 +1,8 @@
---
# Expects snmpd.conf in same directory
# Expects snmpd.conf and snmpd_arm.conf in same directory
- name: configure snmp
hosts: active
remote_user:
remote_user: raylyon
become: yes
vars:
pihole01_key: ""
@@ -75,16 +75,18 @@
mode: '755'
when: pihole.stat.exists
- name: add api key to pihole script for pihole01
replace:
ansible.builtin.lineinfile:
path: "/etc/snmp/pi-hole"
regexp: 'API_AUTH_KEY=""'
replace: 'API_AUTH_KEY="{{ pihole01_key }}"'
regexp: '^API_AUTH_KEY='
line: 'API_AUTH_KEY="{{ pihole01_key }}"'
backrefs: yes
when: ansible_hostname == "pihole01"
- name: add api key to pihole script for pihole02
replace:
ansible.builtin.lineinfile:
path: "/etc/snmp/pi-hole"
regexp: 'API_AUTH_KEY=""'
replace: 'API_AUTH_KEY="{{ pihole02_key }}"'
regexp: '^API_AUTH_KEY='
line: 'API_AUTH_KEY="{{ pihole02_key }}"'
backrefs: yes
when: ansible_hostname == "pihole02"
- name: enable extend nfs-server
ansible.builtin.lineinfile:
@@ -120,8 +122,29 @@
ansible.builtin.lineinfile:
path: "/etc/snmp/snmpd.conf"
line: "extend osupdate /etc/snmp/osupdate"
- name: set ExecStart options in service file - ubuntu
ansible.builtin.lineinfile:
path: "/lib/systemd/system/snmpd.service"
regexp: '^ExecStart='
line: "ExecStart=/usr/sbin/snmpd -LS4d -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -f"
backrefs: yes
when: ansible_os_family == "Debian"
- name: reload systemd configs - ubuntu
ansible.builtin.systemd:
daemon_reload: yes
when: ansible_os_family == "Debian"
- name: set snmpdopts - centos
ansible.builtin.lineinfile:
path: "/etc/sysconfig/snmpd"
regexp: '^# OPTIONS=|^OPTIONS='
line: 'OPTIONS="-LS4-6d"'
when: ansible_os_family == "RedHat"
- name: enable and restart snmpd.service
ansible.builtin.systemd:
state: restarted
enabled: yes
name: snmpd
- name: verify the snmpd service is running
ansible.builtin.systemd:
state: started
name: snmpd