aboutsummaryrefslogtreecommitdiffstats
path: root/ansible/roles/snmp
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/roles/snmp')
-rw-r--r--ansible/roles/snmp/files/gondul-snmp.service14
-rw-r--r--ansible/roles/snmp/handlers/main.yml3
-rw-r--r--ansible/roles/snmp/tasks/main.yml23
3 files changed, 40 insertions, 0 deletions
diff --git a/ansible/roles/snmp/files/gondul-snmp.service b/ansible/roles/snmp/files/gondul-snmp.service
new file mode 100644
index 0000000..e5f2179
--- /dev/null
+++ b/ansible/roles/snmp/files/gondul-snmp.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Gondul snmp collector
+Documentation=http://google.com
+After=network.target
+
+[Service]
+ExecStart=/opt/gondul/collectors/snmpfetchng.pl
+MountFlags=slave
+LimitNOFILE=1048576
+LimitNPROC=1048576
+LimitCORE=infinity
+
+[Install]
+WantedBy=multi-user.target
diff --git a/ansible/roles/snmp/handlers/main.yml b/ansible/roles/snmp/handlers/main.yml
new file mode 100644
index 0000000..b0232f2
--- /dev/null
+++ b/ansible/roles/snmp/handlers/main.yml
@@ -0,0 +1,3 @@
+---
+- name: restart gondul-snmp
+ service: name=gondul-snmp state=restarted
diff --git a/ansible/roles/snmp/tasks/main.yml b/ansible/roles/snmp/tasks/main.yml
new file mode 100644
index 0000000..2cb7165
--- /dev/null
+++ b/ansible/roles/snmp/tasks/main.yml
@@ -0,0 +1,23 @@
+- file:
+ path: /opt/gondul/data
+ state: directory
+ mode: 0755
+- stat:
+ path: /opt/gondul/data/mibs
+ register: mibdir
+- name: Get mibs
+ command: /opt/gondul/extras/tools/get_mibs.sh
+ args:
+ chdir: /opt/gondul/data/
+ when: not mibdir.stat.exists
+ notify: restart gondul-snmp
+- name: Add systemd service file for gondul-snmp
+ copy:
+ dest: /etc/systemd/system/gondul-snmp.service
+ src: gondul-snmp.service
+ notify: restart gondul-snmp
+- name: Enable snmp service
+ systemd:
+ name: gondul-snmp.service
+ enabled: yes
+ notify: restart gondul-snmp