diff --git a/roles/common/files/snmpd b/roles/common/files/snmpd index 80fbc2a..b60b481 100644 --- a/roles/common/files/snmpd +++ b/roles/common/files/snmpd @@ -1,11 +1,3 @@ -# This file controls the activity of snmpd - -# Don't load any MIBs by default. -# You might comment this lines once you have the MIBs downloaded. -export MIBS= - -# snmpd control (yes means start daemon). -SNMPDRUN=yes - -# snmpd options (use syslog, close stdin/out/err). -SNMPDOPTS='-LSed -Lf /dev/null -u snmp -g snmp -I -smux,mteTrigger,mteTriggerConf -p /run/snmpd.pid' +[Service] +ExecStart= +ExecStart=/usr/sbin/snmpd -LSed -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -f diff --git a/roles/common/handlers/main.yml b/roles/common/handlers/main.yml index c7b3cb7..041e8eb 100644 --- a/roles/common/handlers/main.yml +++ b/roles/common/handlers/main.yml @@ -1,5 +1,8 @@ --- +- name: Reload systemd + command: systemctl daemon-reload + - name: Restart snmpd service: name=snmpd state=restarted diff --git a/roles/common/tasks/Debian.yml b/roles/common/tasks/Debian.yml index 6090077..024d02c 100644 --- a/roles/common/tasks/Debian.yml +++ b/roles/common/tasks/Debian.yml @@ -2,21 +2,22 @@ - name: Install snmpd apt: name=snmpd - tags: snmp + +- name: Create snmpd service override directory + file: path=/etc/systemd/system/snmpd.service.d state=directory - name: Make snmpd less verbose - copy: src=snmpd dest=/etc/default/snmpd - notify: Restart snmpd - tags: snmp + copy: src=snmpd dest=/etc/systemd/system/snmpd.service.d/local.conf + notify: + - Reload systemd + - Restart snmpd - name: Configure snmpd template: src=snmpd.conf.j2 dest=/etc/snmp/snmpd.conf notify: Restart snmpd - tags: snmp - name: Start the snmpd service service: name=snmpd state=started enabled=yes - tags: snmp - name: Install misc software apt: name={{ item }}