First somewhat working prototype - only monitoring

This commit is contained in:
2023-12-31 19:42:33 +01:00
commit 009f00a422
15 changed files with 451 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
---
- name: Claim to Netdata Cloud
block:
- name: Claim to Netdata Cloud if not already
shell:
cmd: netdata-claim.sh -token={{ claim_token }} -rooms={{ claim_rooms }} -url={{ claim_url }}
creates: /var/lib/netdata/cloud.d/claimed_id
become: yes
when: reclaim == false
- name: Re-claim a node to Netdata Cloud
block:
- name: Ensure `uuidgen` is installed
stat:
path: /usr/bin/uuidgen
register: uuidgen_result
- name: Fail if `uuidgen` is not installed
fail:
msg: The system needs `uuidgen` installed to enable re-claiming.
when: uuidgen_result.stat.exists == false
- name: Reclaim the node with `-id=`
shell: netdata-claim.sh -token={{ claim_token }} -rooms={{ claim_rooms }} -url={{ claim_url }} -id=$(uuidgen)
when: uuidgen_result.stat.exists == true
notify: Restart Netdata
become: yes
when: reclaim == true

View File

@@ -0,0 +1,15 @@
---
- template:
src: ../templates/netdata.conf.j2
dest: /etc/netdata/netdata.conf
owner: root
group: root
mode: u=wrx,g=rx,o=r,+x
- template:
src: ../templates/stream.conf.j2
dest: /etc/netdata/stream.conf
owner: root
group: root
mode: u=wrx,g=rx,o=r,+x
notify: Restart Netdata
become: true

View File

@@ -0,0 +1,14 @@
---
- name: Download the installation script
get_url:
url: https://my-netdata.io/kickstart.sh
dest: ~/kickstart.sh
mode: +x
- name: Install Netdata
command: ~/kickstart.sh --dont-wait
- name: Cleanup installation script
file:
path: ~/kickstart.sh
state: absent

View File

@@ -0,0 +1,16 @@
---
# Tasks file for Netdata
- name: Install Netdata
become: true
become_method: sudo
import_tasks: install.yml
- name: Configure Netdata
become: true
become_method: sudo
import_tasks: configure.yml
- name: Claim the node to Netdata Cloud
become: true
become_method: sudo
import_tasks: claim.yml