collectd: Install and configure collectd

The *collectd* role, with its corresponding `collectd.yml` playbook,
installs *collectd* onto the managed node and manages basic
configuration for it.  By default, it will enable several plugins,
including the `network` plugin.  The `collectd_disable_plugins` variable
can be set to a list names of plugins that should NOT be enabled.

The default configuration for the `network` plugin instructs *collectd*
to send metrics to the default IPv6 multicast group.  Any host that has
joined this group and is listening on the specified UDP port (default
25826) can receive the data.  This allows for nearly zero configuration,
as the configuration does not need to be updated if the name or IP
address of the receiver changes.

This configuration is ready to be deployed without any variable changes
to all Pyrocufflink servers.  Once *collectd* is running on the servers,
we can set up a *collectd* instance to receive the data and store them
in a time series database (i.e. Prometheus).
This commit is contained in:
2020-12-08 21:11:27 -06:00
parent 750cc8afd4
commit cbbef24bbd
7 changed files with 2202 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
- name: load distribution-specific values
include_vars: '{{ item }}'
with_first_found:
- '{{ ansible_distribution }}.yml'
- defaults.yml
tags:
- always
- name: ensure collectd is installed
package:
name: '{{ collectd_packages }}'
state: present
tags:
- install
- name: ensure collectd is configured
template:
src: collectd.conf.j2
dest: /etc/collectd.conf
mode: '0644'
notify:
- restart collectd
tags:
- collectd-config
- name: ensure collectd network plugin is configured
template:
src: collectd-network.conf.j2
dest: /etc/collectd.d/network.conf
mode: '0644'
notify:
- restart collectd
tags:
- collectd-config
- collectd-network