-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenable_librenms_proxmox.yml
50 lines (44 loc) · 1.32 KB
/
enable_librenms_proxmox.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
- name: Configure SNMP on Proxmox Hosts
hosts: hostlist
tasks:
- name: Install required packages
apt:
name:
- libpve-apiclient-perl
- snmpd
- snmp
- libsnmp-dev
state: present
- name: Download and set permissions for proxmox script
get_url:
url: https://raw.githubusercontent.com/librenms/librenms-agent/master/agent-local/proxmox
dest: /usr/local/bin/proxmox
mode: '0755'
- name: Add Debian-snmp to sudoers for proxmox script
lineinfile:
path: /etc/sudoers
state: present
regexp: '^Debian-snmp ALL='
line: 'Debian-snmp ALL=(ALL) NOPASSWD: /usr/local/bin/proxmox'
validate: 'visudo -cf %s'
- name: Stop snmpd service
service:
name: snmpd
state: stopped
- name: Create SNMPv3 user in /var/lib/snmp/snmpd.conf
lineinfile:
path: /var/lib/snmp/snmpd.conf
line: 'createUser user SHA "password" AES "cryptopassword"'
create: yes
- name: Create simplified snmpd.conf
template:
src: snmpd.conf.j2
dest: /etc/snmp/snmpd.conf
vars:
sysLocation: "{{ inventory_hostname }}"
sysContact: "name number"
- name: Start snmpd service
service:
name: snmpd
state: started