mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
archive old netdata ansible role
This commit is contained in:
parent
de03cc6d36
commit
c9c9e7e6e0
8 changed files with 309 additions and 0 deletions
39
archive/netdata_docker/History.md
Normal file
39
archive/netdata_docker/History.md
Normal file
|
@ -0,0 +1,39 @@
|
|||
# 0.4.0 / 2018-11-30
|
||||
|
||||
* Switch image to dockerhub
|
||||
|
||||
# 0.3.3 / 2017-09-18
|
||||
|
||||
* Fix: Don't reload when the service was just restarted
|
||||
|
||||
# 0.3.2 / 2017-09-18
|
||||
|
||||
* Fix: On slow hosts docker pull runs into timeout
|
||||
|
||||
# 0.3.1 / 2017-09-18
|
||||
|
||||
* Fix: Pull same version as later being used
|
||||
|
||||
# 0.3.0 / 2017-09-01
|
||||
|
||||
* Prevent massive amount of apparmor errors
|
||||
|
||||
# 0.2.0 / 2017-08-31
|
||||
|
||||
* Add persistent data volume
|
||||
|
||||
# 0.1.3 / 2017-08-31
|
||||
|
||||
* Fix: The environment needs to be loaded into the container
|
||||
|
||||
# 0.1.2 / 2017-08-31
|
||||
|
||||
* Fix: File contains secrets and should not be global readable
|
||||
|
||||
# 0.1.1 / 2017-08-31
|
||||
|
||||
* Fix: Remove variable from copy
|
||||
|
||||
# 0.1.0 / 2017-08-31
|
||||
|
||||
* Initial version
|
15
archive/netdata_docker/README.md
Normal file
15
archive/netdata_docker/README.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Luzifer-Ansible / netdata
|
||||
|
||||
This role installs a systemd service running [netdata](https://github.com/firehol/netdata) using Docker and my [Docker image](https://hub.docker.com/r/luzifer/netdata/) for it.
|
||||
|
||||
## Usage
|
||||
|
||||
```yaml
|
||||
roles:
|
||||
- role: netdata
|
||||
config:
|
||||
PUSHOVER_APP_TOKEN: 'mytoken'
|
||||
DEFAULT_RECIPIENT_PUSHOVER: 'myuser'
|
||||
```
|
||||
|
||||
(For configuration values see the [original repositories](https://github.com/luzifer-docker/netdata) README file!)
|
5
archive/netdata_docker/defaults/main.yml
Normal file
5
archive/netdata_docker/defaults/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
|
||||
config: {}
|
||||
hostname: '{{ ansible_hostname }}'
|
||||
version: latest
|
7
archive/netdata_docker/handlers/main.yml
Normal file
7
archive/netdata_docker/handlers/main.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: restart netdata
|
||||
become: yes
|
||||
docker_container:
|
||||
name: netdata
|
||||
restart: yes
|
||||
container_default_behavior: no_defaults
|
134
archive/netdata_docker/meta/main.yml
Normal file
134
archive/netdata_docker/meta/main.yml
Normal file
|
@ -0,0 +1,134 @@
|
|||
---
|
||||
galaxy_info:
|
||||
author: Knut Ahlers
|
||||
description: Install netdata using Docker container on host
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
# Some suggested licenses:
|
||||
# - BSD (default)
|
||||
# - MIT
|
||||
# - GPLv2
|
||||
# - GPLv3
|
||||
# - Apache
|
||||
# - CC-BY
|
||||
license: Apache
|
||||
min_ansible_version: 2.3
|
||||
#
|
||||
# Below are all platforms currently available. Just uncomment
|
||||
# the ones that apply to your role. If you don't see your
|
||||
# platform on this list, let us know and we'll get it added!
|
||||
#
|
||||
platforms:
|
||||
#- name: EL
|
||||
# versions:
|
||||
# - all
|
||||
# - 5
|
||||
# - 6
|
||||
# - 7
|
||||
#- name: GenericUNIX
|
||||
# versions:
|
||||
# - all
|
||||
# - any
|
||||
#- name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 16
|
||||
# - 17
|
||||
# - 18
|
||||
# - 19
|
||||
# - 20
|
||||
# - 21
|
||||
# - 22
|
||||
#- name: SmartOS
|
||||
# versions:
|
||||
# - all
|
||||
# - any
|
||||
#- name: opensuse
|
||||
# versions:
|
||||
# - all
|
||||
# - 12.1
|
||||
# - 12.2
|
||||
# - 12.3
|
||||
# - 13.1
|
||||
# - 13.2
|
||||
#- name: Amazon
|
||||
# versions:
|
||||
# - all
|
||||
# - 2013.03
|
||||
# - 2013.09
|
||||
#- name: GenericBSD
|
||||
# versions:
|
||||
# - all
|
||||
# - any
|
||||
#- name: FreeBSD
|
||||
# versions:
|
||||
# - all
|
||||
# - 8.0
|
||||
# - 8.1
|
||||
# - 8.2
|
||||
# - 8.3
|
||||
# - 8.4
|
||||
# - 9.0
|
||||
# - 9.1
|
||||
# - 9.1
|
||||
# - 9.2
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
# - all
|
||||
# - lucid
|
||||
# - maverick
|
||||
# - natty
|
||||
# - oneiric
|
||||
# - precise
|
||||
# - quantal
|
||||
# - raring
|
||||
# - saucy
|
||||
# - trusty
|
||||
# - utopic
|
||||
# - vivid
|
||||
- xenial
|
||||
#- name: SLES
|
||||
# versions:
|
||||
# - all
|
||||
# - 10SP3
|
||||
# - 10SP4
|
||||
# - 11
|
||||
# - 11SP1
|
||||
# - 11SP2
|
||||
# - 11SP3
|
||||
#- name: GenericLinux
|
||||
# versions:
|
||||
# - all
|
||||
# - any
|
||||
#- name: Debian
|
||||
# versions:
|
||||
# - all
|
||||
# - etch
|
||||
# - jessie
|
||||
# - lenny
|
||||
# - squeeze
|
||||
# - wheezy
|
||||
#
|
||||
# Below are all categories currently available. Just as with
|
||||
# the platforms above, uncomment those that apply to your role.
|
||||
#
|
||||
categories:
|
||||
#- cloud
|
||||
#- cloud:ec2
|
||||
#- cloud:gce
|
||||
#- cloud:rax
|
||||
#- clustering
|
||||
#- database
|
||||
#- database:nosql
|
||||
#- database:sql
|
||||
#- development
|
||||
#- monitoring
|
||||
#- networking
|
||||
#- packaging
|
||||
- system
|
||||
#- web
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line.
|
||||
# Be sure to remove the '[]' above if you add dependencies
|
||||
# to this list.
|
89
archive/netdata_docker/tasks/main.yml
Normal file
89
archive/netdata_docker/tasks/main.yml
Normal file
|
@ -0,0 +1,89 @@
|
|||
---
|
||||
- name: Copy netdata.conf template
|
||||
template:
|
||||
src: /srv/newsblur/docker/netdata/netdataconfig/netdata.conf.j2
|
||||
dest: /srv/newsblur/docker/netdata/netdataconfig/netdata.conf
|
||||
notify: restart netdata
|
||||
|
||||
- name: Setup Netdata docker container
|
||||
become: yes
|
||||
docker_container:
|
||||
name: netdata
|
||||
state: started
|
||||
healthcheck:
|
||||
test: curl localhost:19999
|
||||
image: netdata/netdata:latest
|
||||
ports: 19999:19999
|
||||
pull: yes
|
||||
hostname: "{{ ansible_hostname }}"
|
||||
container_default_behavior: no_defaults
|
||||
capabilities:
|
||||
- SYS_PTRACE
|
||||
security_opts:
|
||||
- apparmor:unconfined
|
||||
env:
|
||||
MONITOR_URL: "https://{{ ansible_ssh_host }}/monitor"
|
||||
STAGING: "True"
|
||||
volumes:
|
||||
- /srv/newsblur/docker/netdata/netdataconfig/netdata.conf:/etc/netdata/netdata.conf
|
||||
- /var/lib/netdata/cloud.d:/var/lib/netdata/cloud.d
|
||||
- /srv/newsblur/docker/netdata/netdataconfig/python.d.conf:/usr/lib/netdata/conf.d/python.d.conf
|
||||
- /srv/newsblur/docker/netdata/netdataconfig/conf/:/usr/lib/netdata/conf.d/python.d/
|
||||
- /srv/newsblur/docker/netdata/netdataconfig/charts/newsblur.chart.py:/usr/libexec/netdata/python.d/newsblur.chart.py
|
||||
- /etc/passwd:/host/etc/passwd:ro
|
||||
- /etc/group:/host/etc/group:ro
|
||||
- /proc:/host/proc:ro
|
||||
- /sys:/host/sys:ro
|
||||
- /etc/os-release:/host/etc/os-release:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
notify: restart netdata
|
||||
|
||||
|
||||
# - name: Add netdata agent to war room
|
||||
# become: yes
|
||||
# command: "docker exec netdata netdata-claim.sh -token={{ netdata_token }} -rooms={{ netdata_room }} -url={{ netdata_url }} -id=$(uuidgen) -hostname={{ ansible_hostname }}"
|
||||
|
||||
- name: Claim to Netdata Cloud
|
||||
block:
|
||||
|
||||
- name: Check if node is already claimed
|
||||
become: yes
|
||||
# This check is used to prevent errors in the following task to claim the node to Netdata Cloud.
|
||||
stat:
|
||||
path: /var/lib/netdata/cloud.d/claimed_id
|
||||
register: claimed_result
|
||||
|
||||
- name: Claim to Netdata Cloud
|
||||
command: "docker exec netdata netdata-claim.sh -token={{ netdata_token }} -rooms={{ netdata_room }} -url={{ netdata_url }} -hostname={{ ansible_hostname }}"
|
||||
when: claimed_result.stat.exists == false
|
||||
notify: restart netdata
|
||||
become: yes
|
||||
when: reclaim == false
|
||||
|
||||
- name: Check if reclaiming
|
||||
debug: msg=Reclaiming
|
||||
changed_when: yes
|
||||
register: reclaim
|
||||
tags:
|
||||
- never
|
||||
- reclaim
|
||||
|
||||
- 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=`
|
||||
command: "docker exec netdata netdata-claim.sh -token={{ netdata_token }} -rooms={{ netdata_room }} -url={{ netdata_url }} -id=$(uuidgen) -hostname={{ ansible_hostname }}"
|
||||
when: uuidgen_result.stat.exists == true
|
||||
notify: restart netdata
|
||||
become: yes
|
||||
when: reclaim is defined
|
5
archive/netdata_docker/templates/environment.j2
Normal file
5
archive/netdata_docker/templates/environment.j2
Normal file
|
@ -0,0 +1,5 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
{% for k,v in config.items() %}
|
||||
{{k}}={{v}}
|
||||
{% endfor %}
|
15
archive/netdata_docker/vars/main.yml
Normal file
15
archive/netdata_docker/vars/main.yml
Normal file
|
@ -0,0 +1,15 @@
|
|||
# https://learn.netdata.cloud/docs/agent/claim
|
||||
netdata_token: "{{ lookup('ini', 'netdata_token section=netdata file=/srv/secrets-newsblur/configs/netdata.ini') }}"
|
||||
netdata_room: "{{ lookup('ini', 'netdata_room section=netdata file=/srv/secrets-newsblur/configs/netdata.ini') }}"
|
||||
netdata_url: https://app.netdata.cloud
|
||||
|
||||
# Force re-claiming of nodes to Netdata Cloud. Read more:
|
||||
# https://learn.netdata.cloud/docs/agent/claim#remove-and-reclaim-a-node
|
||||
reclaim: false
|
||||
|
||||
# Set whether to run the Agent web server/dashboard/API, or disable them.
|
||||
# Because we're connecting this node to Netdata Cloud and will view dashboards
|
||||
# there, we'll set this to `none` to disable the local dashboard. Set to
|
||||
# `static-threaded` if you want to keep it running. Read more:
|
||||
# https://learn.netdata.cloud/docs/configure/secure-nodes
|
||||
web_mode: none
|
Loading…
Add table
Reference in a new issue