forked from HPC/HPCplaybooks
Added somewhat generic nod-exporter and cadvisor playbooks.
This commit is contained in:
parent
7fc312e523
commit
82231aa8ba
5
cadvisor.yml
Normal file
5
cadvisor.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: all
|
||||
become: True
|
||||
roles:
|
||||
- cadvisor
|
5
node-exporter.yml
Normal file
5
node-exporter.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: all
|
||||
become: True
|
||||
roles:
|
||||
- cadvisor
|
25
roles/cadvisor/tasks/main.yml
Normal file
25
roles/cadvisor/tasks/main.yml
Normal 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
|
22
roles/cadvisor/templates/cadvisor.service
Normal file
22
roles/cadvisor/templates/cadvisor.service
Normal 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
|
Loading…
Reference in New Issue
Block a user