blob: c4d2950eac8b7363e6026f3040f751e1dea7772f (
plain)
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
|
---
# This will install nagios
- name: install nagios
yum:
pkg: "{{ item }}"
state: present
with_items:
- nagios
- nagios-plugins
- nagios-plugins-nrpe
- nagios-plugins-ping
- nagios-plugins-ssh
- nagios-plugins-http
- nagios-plugins-mysql
- nagios-devel
notify: restart httpd
- name: create nagios config dir
file:
path: /etc/nagios/ansible-managed
state: directory
- name: configure nagios
copy:
src: nagios.cfg
dest: /etc/nagios/nagios.cfg
notify: restart nagios
- name: configure localhost monitoring
copy:
src: localhost.cfg
dest: /etc/nagios/objects/localhost.cfg
notify: restart nagios
- name: configure nagios services
copy:
src: ansible-managed-services.cfg
dest: /etc/nagios/
- name: create the nagios object files
template:
src: "{{ item + '.j2' }}"
dest: "/etc/nagios/ansible-managed/{{ item }}"
with_items:
- webservers.cfg
- dbservers.cfg
- lbservers.cfg
notify: restart nagios
- name: start nagios
service: name=nagios state=started enabled=yes
|