Added somewhat generic nod-exporter and cadvisor playbooks.

This commit is contained in:
Egon Rijpkema 2019-01-02 13:34:52 +01:00
parent 7fc312e523
commit 82231aa8ba
4 changed files with 57 additions and 0 deletions

5
cadvisor.yml Normal file
View File

@ -0,0 +1,5 @@
---
- hosts: all
become: True
roles:
- cadvisor

5
node-exporter.yml Normal file
View File

@ -0,0 +1,5 @@
---
- hosts: all
become: True
roles:
- cadvisor

View File

@ -0,0 +1,25 @@
---
- name: Install service files.
template:
src: templates/cadvisor.service
dest: /etc/systemd/system/cadvisor.service
mode: 644
owner: root
group: root
tags:
- service-files
- name: install service files
command: systemctl daemon-reload
- name: enable service at boot
systemd:
name: cadvisor
enabled: yes
- name: make sure servcies are started.
systemd:
name: cadvisor.service
state: restarted
tags:
- start-service

View File

@ -0,0 +1,22 @@
[Unit]
Description=Prometheus container monitoring.
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker kill %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStart=/usr/bin/docker run --name %n \
--volume=/:/rootfs:ro \
--volume=/var/run:/var/run:rw \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--volume=/dev/disk/:/dev/disk:ro \
--publish=8181:8080 \
google/cadvisor:latest
[Install]
WantedBy=multi-user.target