ansible-roles/system/extra/netdata/tasks/main.yml

81 lines
2.1 KiB
YAML
Raw Normal View History

2023-10-08 00:15:34 +02:00
---
- name: "install netdata"
ansible.builtin.apt:
name:
- "netdata"
- "uuid-runtime"
register: system_extra_netdata_install
2023-10-22 12:12:14 +02:00
- name: "install lm-sensors"
ansible.builtin.apt:
name:
- "lm-sensors"
register: system_extra_netdata_lm_sensors_install
when:
system_extra_netdata_install_sensors
2023-10-29 15:56:35 +01:00
- name: "create systemd override directory"
ansible.builtin.file:
path: "/etc/systemd/system/netdata.service.d"
state: "directory"
mode: 0755
- name: "create override configuration"
ansible.builtin.copy:
src: "./systemd/override.conf"
dest: "/etc/systemd/system/netdata.service.d/override.conf"
mode: 0644
register: system_extra_netdata_systemd_override
- name: "systemd user daemon reload"
ansible.builtin.systemd:
daemon_reload: true
when:
system_extra_netdata_systemd_override.changed
2023-10-08 00:15:34 +02:00
- name: "enable netdata"
ansible.builtin.systemd:
name: "netdata"
enabled: true
- name: "configure netdata"
ansible.builtin.template:
src: "./netdata.conf"
dest: "/etc/netdata/netdata.conf"
2023-10-30 21:24:57 +01:00
mode: 0644
2023-10-08 00:15:34 +02:00
register: system_extra_netdata_netdata_conf
- name: "configure netdata stream"
ansible.builtin.template:
src: "./stream.conf"
dest: "/etc/netdata/stream.conf"
2023-10-30 21:24:57 +01:00
mode: 0644
2023-10-08 00:15:34 +02:00
register: system_extra_netdata_stream_conf
2023-10-08 18:48:41 +02:00
- name: "configure netdata health notifications"
ansible.builtin.template:
src: "./health_alarm_notify.conf"
dest: "/etc/netdata/health_alarm_notify.conf"
2023-10-30 21:24:57 +01:00
mode: 0644
2023-10-08 18:48:41 +02:00
register: system_extra_netdata_health_conf
2023-10-08 00:15:34 +02:00
- name: "start netdata"
ansible.builtin.systemd:
name: "netdata"
state: "started"
register: system_extra_netdata_start
- name: "restart netdata"
ansible.builtin.systemd:
name: "netdata"
state: "restarted"
when:
(system_extra_netdata_install.changed or
2023-10-22 12:12:14 +02:00
(system_extra_netdata_lm_sensors_install is defined and
system_extra_netdata_lm_sensors_install.changed) or
2023-10-29 15:56:35 +01:00
system_extra_netdata_systemd_override.changed or
2023-10-08 00:15:34 +02:00
system_extra_netdata_netdata_conf.changed or
2023-10-08 18:48:41 +02:00
system_extra_netdata_stream_conf.changed or
system_extra_netdata_health_conf.changed) and
2023-10-08 00:15:34 +02:00
not system_extra_netdata_start.changed