First somewhat working prototype - only monitoring
This commit is contained in:
31
roles/monitoring/tasks/claim.yml
Normal file
31
roles/monitoring/tasks/claim.yml
Normal 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
|
||||
15
roles/monitoring/tasks/configure.yml
Normal file
15
roles/monitoring/tasks/configure.yml
Normal 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
|
||||
14
roles/monitoring/tasks/install.yml
Normal file
14
roles/monitoring/tasks/install.yml
Normal 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
|
||||
16
roles/monitoring/tasks/main.yml
Normal file
16
roles/monitoring/tasks/main.yml
Normal 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
|
||||
Reference in New Issue
Block a user