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

58 lines
1.5 KiB
YAML

---
- name: "install netdata"
ansible.builtin.apt:
name:
- "netdata"
- "uuid-runtime"
register: system_extra_netdata_install
- name: "install lm-sensors"
ansible.builtin.apt:
name:
- "lm-sensors"
register: system_extra_netdata_lm_sensors_install
when:
system_extra_netdata_install_sensors
- name: "enable netdata"
ansible.builtin.systemd:
name: "netdata"
enabled: true
- name: "configure netdata"
ansible.builtin.template:
src: "./netdata.conf"
dest: "/etc/netdata/netdata.conf"
register: system_extra_netdata_netdata_conf
- name: "configure netdata stream"
ansible.builtin.template:
src: "./stream.conf"
dest: "/etc/netdata/stream.conf"
register: system_extra_netdata_stream_conf
- name: "configure netdata health notifications"
ansible.builtin.template:
src: "./health_alarm_notify.conf"
dest: "/etc/netdata/health_alarm_notify.conf"
register: system_extra_netdata_health_conf
- 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
(system_extra_netdata_lm_sensors_install is defined and
system_extra_netdata_lm_sensors_install.changed) or
system_extra_netdata_netdata_conf.changed or
system_extra_netdata_stream_conf.changed or
system_extra_netdata_health_conf.changed) and
not system_extra_netdata_start.changed