Add netdata docker-compose file
This commit is contained in:
parent
01ce422e11
commit
3142ba75c6
3 changed files with 56 additions and 0 deletions
21
ansible/roles/docker/files/netdata/docker-compose.yml
Normal file
21
ansible/roles/docker/files/netdata/docker-compose.yml
Normal 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"
|
|
@ -3,3 +3,6 @@
|
||||||
|
|
||||||
- name: Install Docker
|
- name: Install Docker
|
||||||
include: setup-docker.yml
|
include: setup-docker.yml
|
||||||
|
|
||||||
|
- name: Install netdata
|
||||||
|
include: netdata.yml
|
||||||
|
|
32
ansible/roles/docker/tasks/netdata.yml
Normal file
32
ansible/roles/docker/tasks/netdata.yml
Normal 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
|
Loading…
Reference in a new issue