Refactor netdata to use docker_compose directive & expose configs #80

Closed
graffen wants to merge 1 commit from refactor_netdata into main
2 changed files with 58 additions and 25 deletions
Showing only changes of commit 73cc8cbbb3 - Show all commits

View file

@ -49,6 +49,7 @@ hedgedoc:
netdata: netdata:
domain: "netdata.{{ base_domain }}" domain: "netdata.{{ base_domain }}"
volume_folder: "{{ volume_root_folder }}/netdata"
docker_registry: docker_registry:
domain: "docker.{{ base_domain }}" domain: "docker.{{ base_domain }}"

View file

@ -1,27 +1,59 @@
--- ---
- name: create netdata volume folders
file:
name: "{{ netdata.volume_folder }}/{{ volume }}"
state: directory
loop:
- "config"
- "lib"
- "cache"
loop_control:
loop_var: volume
- name: setup netdata docker container for system monitoring - name: "setup netdata for system monitoring"
docker_container: docker_compose:
name: netdata project_name: "netdata"
image: netdata/netdata pull: "yes"
restart_policy: unless-stopped definition:
services:
netdata:
image: "netdata/netdata"
restart: "unless-stopped"
hostname: "hevonen.servers.{{ base_domain }}" hostname: "hevonen.servers.{{ base_domain }}"
capabilities: cap_add:
- SYS_PTRACE - SYS_PTRACE
security_opts: security_opt:
- apparmor:unconfined - apparmor:unconfined
volumes: volumes:
- /proc:/host/proc:ro - "{{ netdata.volume_folder }}/config:/etc/netdata"
- /sys:/host/sys:ro - "{{ netdata.volume_folder }}/lib:/var/lib/netdata"
- /var/run/docker.sock:/var/run/docker.sock:ro - "{{ netdata.volume_folder }}/cache:/var/cache/netdata"
- "/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"
networks: networks:
- name: external_services - external_services
env: - docker_proxy
environment:
VIRTUAL_HOST : "{{ netdata.domain }}" VIRTUAL_HOST : "{{ netdata.domain }}"
LETSENCRYPT_HOST: "{{ netdata.domain }}" LETSENCRYPT_HOST: "{{ netdata.domain }}"
LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
PGID: "999" PGID: "999"
DOCKER_HOST: "proxy:2375"
labels: labels:
com.ouroboros.enable: "true" com.ouroboros.enable: "true"
proxy:
image: "tecnativa/docker-socket-proxy"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
environment:
CONTAINERS : 1
networks:
- docker_proxy
networks:
docker_proxy:
external_services:
external: true