Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions roles/_meta/common_base/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,5 @@ dependencies:
when: is_local is not defined or not is_local
- role: debian/bash
when: is_local is not defined or not is_local
- role: debian/collectd
when: is_local is not defined or not is_local
8 changes: 8 additions & 0 deletions roles/debian/collectd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# CollectD
This role provides the collectd server statistics daemon facilitating exporting of system stats to cloudwatch

<!--TOC-->
<!--ENDTOC-->

<!--ROLEVARS-->
<!--ENDROLEVARS-->
36 changes: 36 additions & 0 deletions roles/debian/collectd/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
- name: Check if we already have collectd installed.
ansible.builtin.stat:
path: "/usr/sbin/collectd"
register: collectd_bin

- name: Check if collectd config directory exists.
ansible.builtin.stat:
path: "/etc/collectd"
register: collectd_configdir

- name: Install collectd if not installed.
ansible.builtin.apt:
pkg: collectd
state: present
when:
- not collectd_bin.stat.exists

- name: Create collectd config directory.
ansible.builtin.file:
path: /etc/collectd
state: directory
mode: '0755'
when:
- not collectd_configdir.stat.exists

- name: Place collectd configuration.
ansible.builtin.template:
src: "collectd.conf.j2"
dest: "/etc/collectd/collectd.conf"
owner: root
group: root
mode: 0644
force: true
when:
- collectd_configdir.stat.exists
Loading
Loading