94 lines
2 KiB
YAML
94 lines
2 KiB
YAML
# yamllint disable rule:line-length
|
|
---
|
|
- name: "Install Collectd package"
|
|
openbsd_pkg:
|
|
name: "collectd"
|
|
tags:
|
|
- collectd
|
|
|
|
- name: "Deploy Collectd configuration"
|
|
template:
|
|
src: "collectd.conf.j2"
|
|
dest: "/etc/collectd.conf"
|
|
notify: restart collectd
|
|
tags:
|
|
- collectd
|
|
|
|
- name: "Enabling Collectd"
|
|
service:
|
|
name: collectd
|
|
enabled: true
|
|
when: not ansible_check_mode
|
|
tags:
|
|
- collectd
|
|
|
|
- name: "Create scripts directory for exec plugins"
|
|
file:
|
|
path: /usr/local/share/collectd/scripts
|
|
state: directory
|
|
when: collectd_plugin_exec_ifq_drops or collectd_plugin_exec_dns_stats or collectd_plugin_exec_dhcp_pool
|
|
tags:
|
|
- collectd
|
|
|
|
- name: "Copy ifq_drops.sh"
|
|
copy:
|
|
src: ifq_drops.sh
|
|
dest: /usr/local/share/collectd/scripts/ifq_drops.sh
|
|
mode: 0755
|
|
force: true
|
|
when: collectd_plugin_exec_ifq_drops
|
|
tags:
|
|
- collectd
|
|
|
|
- name: "Remove ifq_drops.sh"
|
|
file:
|
|
path: /usr/local/share/collectd/scripts/ifq_drops.sh
|
|
state: absent
|
|
when: not collectd_plugin_exec_ifq_drops
|
|
tags:
|
|
- collectd
|
|
|
|
- name: "Copy dns_stats.sh"
|
|
copy:
|
|
src: dns_stats.sh
|
|
dest: /usr/local/share/collectd/scripts/dns_stats.sh
|
|
mode: 0755
|
|
force: true
|
|
when: collectd_plugin_exec_dns_stats
|
|
tags:
|
|
- collectd
|
|
|
|
- name: "Remove dns_stats.sh"
|
|
file:
|
|
path: /usr/local/share/collectd/scripts/dns_stats.sh
|
|
state: absent
|
|
when: not collectd_plugin_exec_dns_stats
|
|
tags:
|
|
- collectd
|
|
|
|
- name: "Add doas configuration for dns_stats.sh execution"
|
|
lineinfile:
|
|
path: /etc/doas.conf
|
|
line: 'permit nopass _collectd as root cmd /usr/sbin/unbound-control args stats'
|
|
when: collectd_plugin_exec_dns_stats
|
|
tags:
|
|
- collectd
|
|
|
|
- name: "Copy dhcp_pool.pl"
|
|
copy:
|
|
src: dhcp_pool.pl
|
|
dest: /usr/local/share/collectd/scripts/dhcp_pool.pl
|
|
mode: 0755
|
|
force: true
|
|
when: collectd_plugin_exec_dhcp_pool
|
|
tags:
|
|
- collectd
|
|
|
|
- name: "Remove dhcp_pool.pl"
|
|
file:
|
|
path: /usr/local/share/collectd/scripts/dhcp_pool.pl
|
|
state: absent
|
|
when: not collectd_plugin_exec_dhcp_pool
|
|
tags:
|
|
- collectd
|