commit
bf5b28933c
@ -0,0 +1,15 @@ |
||||
autonomic.netdata: Install and configure Netdata how we need it |
||||
Copyright (C) 2022 Autonomic Co-operative <helo@autonomic.zone> |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. |
@ -0,0 +1,2 @@ |
||||
--- |
||||
netdata_upgrade: true |
@ -0,0 +1,5 @@ |
||||
--- |
||||
- name: Restart netdata |
||||
service: |
||||
name: netdata |
||||
state: restarted |
@ -0,0 +1,14 @@ |
||||
--- |
||||
dependencies: [] |
||||
|
||||
galaxy_info: |
||||
author: autonomic |
||||
description: | |
||||
Install and configure Netdata how we need it. |
||||
company: Autonomic |
||||
license: GPLv3 |
||||
min_ansible_version: 2.9 |
||||
platforms: |
||||
- name: Debian |
||||
versions: |
||||
- buster |
@ -0,0 +1,17 @@ |
||||
--- |
||||
- name: Converge |
||||
hosts: all |
||||
vars: |
||||
netdata_alerta_api_key: bazbang |
||||
netdata_alerta_recipient: foobar |
||||
netdata_alerta_web_hook_url: barfoo |
||||
tasks: |
||||
- name: "Include autonomic.netdata (install)" |
||||
include_role: |
||||
name: autonomic.netdata |
||||
|
||||
- name: "Include autonomic.netdata (upgrade)" |
||||
vars: |
||||
netdata_upgrade: true |
||||
include_role: |
||||
name: autonomic.netdata |
@ -0,0 +1,31 @@ |
||||
--- |
||||
dependency: |
||||
name: galaxy |
||||
driver: |
||||
name: hetznercloud |
||||
platforms: |
||||
- name: "autonomic.netdata-${INSTANCE_UUID}" |
||||
server_type: "cx11" |
||||
image: "debian-10" |
||||
provisioner: |
||||
name: ansible |
||||
lint: | |
||||
set -e |
||||
yamllint -c ../../.yamllint.yml . |
||||
ansible-lint -c ../../.ansible-lint.yml . |
||||
scenario: |
||||
test_sequence: |
||||
- lint |
||||
- dependency |
||||
- cleanup |
||||
- destroy |
||||
- syntax |
||||
- create |
||||
- prepare |
||||
- converge |
||||
# TODO(decentral1se): Quick fix for https://git.autonomic.zone/autonomic-cooperative/infrastructure/issues/166 |
||||
# - idempotence |
||||
- side_effect |
||||
- verify |
||||
- cleanup |
||||
- destroy |
@ -0,0 +1,19 @@ |
||||
--- |
||||
- name: Add alerta web hook |
||||
no_log: true |
||||
lineinfile: |
||||
line: ALERTA_WEBHOOK_URL="{{ netdata_alerta_web_hook_url }}" |
||||
dest: /etc/netdata/health_alarm_notify.conf |
||||
regexp: "^ALERTA_WEBHOOK_URL" |
||||
|
||||
- name: Add alerta API key |
||||
lineinfile: |
||||
line: ALERTA_API_KEY="{{ netdata_alerta_api_key }}" |
||||
dest: /etc/netdata/health_alarm_notify.conf |
||||
regexp: "^ALERTA_API_KEY" |
||||
|
||||
- name: Add alerta recipient |
||||
lineinfile: |
||||
line: DEFAULT_RECIPIENT_ALERTA="{{ netdata_alerta_recipient }}" |
||||
dest: /etc/netdata/health_alarm_notify.conf |
||||
regexp: "^DEFAULT_RECIPIENT_ALERTA" |
@ -0,0 +1,43 @@ |
||||
--- |
||||
- 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 |
Reference in new issue