mirror of
https://github.com/KevinMidboe/playbooks-retailor.git
synced 2025-10-29 09:40:34 +00:00
all prometheus exporter folders get same name prefix
This commit is contained in:
3
roles/exporter-cadvisor/defaults/main.yml
Normal file
3
roles/exporter-cadvisor/defaults/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
cadvisor_version: "0.46.0"
|
||||
cadvisor_binary_url: "https://github.com/google/cadvisor/releases/download/v{{ cadvisor_version }}/cadvisor-v{{ cadvisor_version }}-linux-amd64"
|
||||
5
roles/exporter-cadvisor/handlers/main.yml
Normal file
5
roles/exporter-cadvisor/handlers/main.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: Restart cAdvisor
|
||||
docker_container:
|
||||
name: cadvisor
|
||||
state: restarted
|
||||
13
roles/exporter-cadvisor/meta/main.yml
Normal file
13
roles/exporter-cadvisor/meta/main.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
galaxy_info:
|
||||
author: Your Name
|
||||
description: Ansible role to deploy cAdvisor using Docker
|
||||
license: MIT
|
||||
min_ansible_version: "2.9"
|
||||
platforms:
|
||||
- name: Debian
|
||||
versions:
|
||||
- all
|
||||
galaxy_tags:
|
||||
- monitoring
|
||||
- cadvisor
|
||||
39
roles/exporter-cadvisor/tasks/install.yml
Normal file
39
roles/exporter-cadvisor/tasks/install.yml
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
- name: Ensure the cAdvisor binary is downloaded
|
||||
get_url:
|
||||
url: "{{ cadvisor_binary_url }}"
|
||||
dest: "/usr/local/bin/cadvisor"
|
||||
mode: '0755'
|
||||
tags:
|
||||
- install_cadvisor
|
||||
|
||||
- name: Create cAdvisor data directory
|
||||
file:
|
||||
path: "/var/lib/cadvisor"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
tags:
|
||||
- create_cadvisor_data_dir
|
||||
|
||||
- name: Create cAdvisor service
|
||||
template:
|
||||
src: "cadvisor.service.j2"
|
||||
dest: "/etc/systemd/system/cadvisor.service"
|
||||
mode: '0644'
|
||||
tags:
|
||||
- create_cadvisor_service
|
||||
|
||||
- name: Reload systemd to pick up the cAdvisor service
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
tags:
|
||||
- reload_systemd
|
||||
|
||||
- name: Enable and start the cAdvisor service
|
||||
systemd:
|
||||
name: cadvisor
|
||||
state: started
|
||||
enabled: yes
|
||||
tags:
|
||||
- start_cadvisor
|
||||
|
||||
5
roles/exporter-cadvisor/tasks/main.yml
Normal file
5
roles/exporter-cadvisor/tasks/main.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: Install cAdvisor (native binary)
|
||||
include_tasks: install.yml
|
||||
tags:
|
||||
- install
|
||||
12
roles/exporter-cadvisor/templates/cadvisor.service.j2
Normal file
12
roles/exporter-cadvisor/templates/cadvisor.service.j2
Normal file
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=cAdvisor
|
||||
Documentation=https://github.com/google/cadvisor
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/cadvisor
|
||||
Restart=always
|
||||
LimitNOFILE=4096
|
||||
User=root
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user