blob: 09f627e7a93bcd934ebe38aba2f3a396623ca993 (
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
---
# collectd client setup
# install pkg
- name: install collectd
yum: name=collectd state=present
tags:
- collectd
when: ansible_distribution_major_version|int < 22
# install pkg
- name: install collectd
dnf: name=collectd state=present
tags:
- collectd
when: ansible_distribution_major_version|int > 21
# install collectd-disk on F25+ (it was split out)
- name: install collectd-disk
dnf: name=collectd-disk state=present
tags:
- collectd
when: ansible_distribution_major_version|int > 24
# install collected.conf
- name: /etc/collectd.conf
template: src=collectd.conf.j2 dest=/etc/collectd.conf
tags:
- collectd
notify:
- restart collectd
# install collectd-network config
- name: /etc/collectd.d/network.conf
template: src=network-client.conf.j2 dest=/etc/collectd.d/network.conf
tags:
- collectd
notify:
- restart collectd
when: not inventory_hostname.startswith('log')
# install collectd-network config
- name: /etc/collectd.d/network.conf
copy: src=network-server.conf dest=/etc/collectd.d/network.conf
tags:
- collectd
notify:
- restart collectd
when: inventory_hostname.startswith('log')
# apache - localhost only - pretty much any apache server
- name: install collectd-apache (yum)
yum: state=present name=collectd-apache
tags:
- collectd
notify:
- restart collectd
when: collectd_apache and ansible_distribution_major_version|int < 22
- name: install collectd-apache (dnf)
dnf: state=present name=collectd-apache
tags:
- collectd
notify:
- restart collectd
when: collectd_apache and ansible_distribution_major_version|int > 21
- name: /etc/collectd/apache.conf
copy: src=apache.conf dest=/etc/collectd.d/apache.conf
tags:
- collectd
notify:
- restart collectd
when: collectd_apache
- name: /etc/collectd/graphite.conf
template: src=graphite.conf dest=/etc/collectd.d/graphite.conf
tags:
- collectd
- graphite
- graphite-collectd
notify:
- restart collectd
when: collectd_graphite is defined and ansible_distribution_major_version != '6'
- name: Install libsemanage-python so we can set an sebool below
yum: name=libsemanage-python state=present
tags:
- collectd
when: collectd_apache is defined and ansible_distribution_major_version|int < 22
- name: Let collectd talk to things over tcp
seboolean: name=collectd_tcp_network_connect state=yes persistent=yes
tags:
- collectd
ignore_errors: True
notify:
- restart collectd
when: ( collectd_apache is defined or collectd_graphite is defined ) and ansible_selinux.status != "disabled"
- name: enable collectd nfs module
copy: src=nfs.conf dest=/etc/collectd.d/nfs.conf
tags:
- collectd
notify:
- restart collectd
# Three tasks for handling our (two) custom selinux modules.
- name: ensure a directory exists for our custom selinux module
file: dest=/usr/share/collectd state=directory
tags:
- collectd
- selinux
- name: copy over our general collectd selinux module
copy: src=selinux/fi-collectd.pp dest=/usr/share/collectd/fi-collectd.pp
register: ficgeneral_module
tags:
- collectd
- selinux
- name: check to see if its even installed yet
shell: semodule -l | grep fi-collectd | wc -l
register: ficgeneral_grep
check_mode: no
changed_when: "'0' in ficgeneral_grep.stdout"
tags:
- collectd
- selinux
- name: install our general collectd selinux module
command: semodule -i /usr/share/collectd/fi-collectd.pp
when: ficgeneral_module|changed or ficgeneral_grep|changed
tags:
- collectd
- selinux
- name: copy over our pstorefs/collectd selinux module (rhel6 has no pstorefs)
copy: src=selinux/fi-pstorefs.pp dest=/usr/share/collectd/fi-pstorefs.pp
when: ansible_distribution_major_version|int != 6
register: ficpstorefs_module
tags:
- collectd
- selinux
- name: check to see if its even installed yet
shell: semodule -l | grep fi-pstorefs | wc -l
when: ansible_distribution_major_version|int != 6
register: ficpstorefs_grep
check_mode: no
changed_when: "'0' in ficpstorefs_grep.stdout"
tags:
- collectd
- selinux
- name: install our pstorefs/collectd selinux module
command: semodule -i /usr/share/collectd/fi-pstorefs.pp
when: ansible_distribution_major_version|int != 6 and (ficpstorefs_module|changed or ficpstorefs_grep|changed)
tags:
- collectd
- selinux
# each of the below should move to a separate task list
# since they are odd-balls and one-offs
# fedmsg - busgateway## only
# add /usr/share/collectd/fedmsg-types.db
# memcached - memcached only
# postgres - this is a conn check
## add /usr/share/collectd/pgconn-types.db
# openvpn - for bastion/openvpn gateways only
# mysql
## collectd-mysql
# haproxy
## add /usr/share/collectd/haproxy-types.db
## add socat pkg
##
# webproxy
# enable collectd
- name: enable collectd svc
service: state=started enabled=true name=collectd
tags:
- collectd
|