-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnmp.yml
63 lines (46 loc) · 1.78 KB
/
snmp.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
51
52
53
54
55
56
57
58
59
60
61
62
63
---
- hosts: all
become: yes
become_method: sudo
become_user: root
gather_facts: yes
tasks:
- name: Install SNMP RPMs for ubuntu version 20
apt:
name: snmpd
state: present
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "20")
- name: Install SNMP RPMs for Amazon Linux 2
yum: name={{ item }} state=present
with_items:
- net-snmp
- net-snmp-utils
when: (ansible_distribution == "Amazon" and ansible_distribution_major_version == "2")
- name: Install SNMP RPMs for ubuntu version 14.04
shell: |
apt-get install snmpd libsnmp30 libsnmp-base
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "14")
- name: Install SNMP RPMs for ubuntu version 18.04
apt:
name: snmpd
state: present
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "18")
- name: Configuring the snmpd
shell: |
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf_old
touch /etc/snmp/snmpd.conf
cat <<EOT >> /etc/snmp/snmpd.conf
#NMPv1 and v2 are not allowed at Granicus
#group notConfigGroup v1 notConfigUser
#group notConfigGroup v2c notConfigUser
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
access notConfigGroup “” any noauth exact systemview none none
dontLogTCPWrappersConnects yes
#includeDir /etc/snmp/local_config
rouser asysp-snmp
createUser asysp-snmp SHA “h54G54bMBuY59yd6" AES h54G54bMBuY59yd6
EOT
- name: Restart snmpd
shell: |
sudo service snmpd restart