Skip to content

Commit 64106b3

Browse files
authored
r71553-install-collectd (#2387)
1 parent 9024bdd commit 64106b3

File tree

4 files changed

+1569
-0
lines changed

4 files changed

+1569
-0
lines changed

roles/_meta/common_base/meta/main.yml

+2
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,5 @@ dependencies:
4949
when: is_local is not defined or not is_local
5050
- role: debian/bash
5151
when: is_local is not defined or not is_local
52+
- role: debian/collectd
53+
when: is_local is not defined or not is_local

roles/debian/collectd/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# CollectD
2+
This role provides the collectd server statistics daemon facilitating exporting of system stats to cloudwatch
3+
4+
<!--TOC-->
5+
<!--ENDTOC-->
6+
7+
<!--ROLEVARS-->
8+
<!--ENDROLEVARS-->

roles/debian/collectd/tasks/main.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
- name: Check if we already have collectd installed.
3+
ansible.builtin.stat:
4+
path: "/usr/sbin/collectd"
5+
register: collectd_bin
6+
7+
- name: Check if collectd config directory exists.
8+
ansible.builtin.stat:
9+
path: "/etc/collectd"
10+
register: collectd_configdir
11+
12+
- name: Install collectd if not installed.
13+
ansible.builtin.apt:
14+
pkg: collectd
15+
state: present
16+
when:
17+
- not collectd_bin.stat.exists
18+
19+
- name: Create collectd config directory.
20+
ansible.builtin.file:
21+
path: /etc/collectd
22+
state: directory
23+
mode: '0755'
24+
when:
25+
- not collectd_configdir.stat.exists
26+
27+
- name: Place collectd configuration.
28+
ansible.builtin.template:
29+
src: "collectd.conf.j2"
30+
dest: "/etc/collectd/collectd.conf"
31+
owner: root
32+
group: root
33+
mode: 0644
34+
force: true
35+
when:
36+
- collectd_configdir.stat.exists

0 commit comments

Comments
 (0)