44 lines
1.2 KiB
YAML
44 lines
1.2 KiB
YAML
---
|
|
- name: Ensure mandatory variables are configured
|
|
assert:
|
|
that: "{{ item }} is defined"
|
|
fail_msg: "You must define the '{{ item }}' variable"
|
|
with_items:
|
|
- netdata_alerta_api_key
|
|
- netdata_alerta_recipient
|
|
- netdata_alerta_web_hook_url
|
|
|
|
- name: Check if netdata installation present
|
|
stat:
|
|
path: /etc/netdata/.environment
|
|
register: netdata_install
|
|
|
|
- name: Download the installer script
|
|
get_url:
|
|
url: https://my-netdata.io/kickstart.sh
|
|
dest: /tmp/netdata-kickstart.sh
|
|
mode: a+x
|
|
force: true
|
|
when: not netdata_install.stat.exists or netdata_upgrade
|
|
|
|
- name: Run netdata installer script (install/ugrade as required)
|
|
command: |
|
|
bash /tmp/netdata-kickstart.sh
|
|
--dont-wait
|
|
--stable-channel
|
|
--disable-cloud
|
|
when: not netdata_install.stat.exists or netdata_upgrade
|
|
notify: Restart netdata
|
|
|
|
- name: Ensure health_alarm_notify script is in /etc/netdata
|
|
copy:
|
|
src: /usr/lib/netdata/conf.d/health_alarm_notify.conf
|
|
dest: /etc/netdata/health_alarm_notify.conf
|
|
remote_src: true
|
|
force: false
|
|
when: not netdata_install.stat.exists
|
|
|
|
- name: Include alerta configuration tasks
|
|
include: alerta.yml
|
|
when: not netdata_install.stat.exists
|