Browse Source

Added somewhat generic nod-exporter and cadvisor playbooks.

pull/1/head
Egon Rijpkema 4 years ago
parent
commit
82231aa8ba
  1. 5
      cadvisor.yml
  2. 5
      node-exporter.yml
  3. 25
      roles/cadvisor/tasks/main.yml
  4. 22
      roles/cadvisor/templates/cadvisor.service

5
cadvisor.yml

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

5
node-exporter.yml

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

25
roles/cadvisor/tasks/main.yml

@ -0,0 +1,25 @@ @@ -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

22
roles/cadvisor/templates/cadvisor.service

@ -0,0 +1,22 @@ @@ -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