Add netdata docker-compose file

This commit is contained in:
Jake Howard 2020-01-28 21:50:29 +00:00
parent 01ce422e11
commit 3142ba75c6
Signed by: jake
GPG key ID: 57AFB45680EDD477
3 changed files with 56 additions and 0 deletions

View file

@ -0,0 +1,21 @@
version: '3'
services:
netdata:
image: netdata/netdata:latest
container_name: netdata
cap_add:
- SYS_PTRACE
security_opt:
- apparmor:unconfined
volumes:
- /etc/passwd:/host/etc/passwd:ro
- /etc/group:/host/etc/group:ro
- /proc:/host/proc:ro
- /sys:/host/sys:ro
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.netdata.rule=Host(`netdata.jakehoward.tech`)"
- "traefik.http.routers.netdata.tls=true"
- "traefik.http.routers.netdata.tls.certresolver=le"
- "traefik.http.routers.netdata.middlewares=internal-only@file"

View file

@ -3,3 +3,6 @@
- name: Install Docker
include: setup-docker.yml
- name: Install netdata
include: netdata.yml

View file

@ -0,0 +1,32 @@
- name: Create netdata directory
file:
path: '/opt/netdata'
state: directory
owner: "{{ docker_user.name }}"
mode: 0755
become: true
become_user: root
- name: Install netdata config
template:
src: files/netdata/docker-compose.yml
dest: "/opt/netdata/docker-compose.yml"
mode: 0644
owner: "{{ docker_user.name }}"
backup: true
trim_blocks: false
register: compose_file
become: true
become_user: root
- name: Cycle container
docker_compose:
project_src: /opt/netdata
pull: true
remove_orphans: true
remove_volumes: true
state: "{{ item }}"
when: compose_file.changed
loop:
- absent
- present