Commit initial

This commit is contained in:
Navas 2022-06-12 23:07:59 +02:00
commit 270186dc11
5 changed files with 69 additions and 0 deletions

25
README.md Normal file
View file

@ -0,0 +1,25 @@
# Role : docker_nodeexporter
## Services fournis
- main.yml : Installation de nodeexporter sur un serveur docker_host
## Variables
Fournir les variables suivantes. Par exemple :
```yaml
docker_nodeexporter_version: v1.3.1
docker_nodeexporter_data_dir: /data1
docker_nodeexporter_service_id: node-exporter
```
| Option | Valeur par défaut | Description |
|--------------------------------|-------------------|------------------------------------------------------------------|
| docker_nodeexporter_version | | Version de l'image nodeexporter |
| docker_nodeexporter_data_dir | | L'emplacement dans lequel se trouvent le dossier docker |
| docker_nodeexporter_service_id | | Le nom de service souhaité : conditionne le nommage des dossiers |
| docker_nodeexporter_port | 9100 | Le numero de port local pour l'accès à nodeexporter |

1
defaults/main.yml Normal file
View file

@ -0,0 +1 @@
docker_nodeexporter_port: "9100"

5
handlers/main.yml Normal file
View file

@ -0,0 +1,5 @@
- name: docker-compose-up
shell: |
docker-compose up -d
args:
chdir: /opt/{{ docker_nodeexporter_service_id }}/

14
tasks/main.yml Normal file
View file

@ -0,0 +1,14 @@
- name: docker directory
file:
path: /opt/{{ docker_nodeexporter_service_id }}/
state: directory
- name: prepare docker-compose.yml
template:
src: "{{ item }}"
dest: /opt/{{ docker_nodeexporter_service_id }}/
with_items:
- docker-compose.yml
notify: docker-compose-up

View file

@ -0,0 +1,24 @@
# {{ ansible_managed }}
version: '3.1'
services:
nodeexporter:
image: prom/node-exporter:{{ docker_nodeexporter_version }}
environment:
- TZ=Europe/Paris
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.rootfs=/rootfs'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
restart: always
labels:
org.label-schema.group: "monitoring"
ports:
- {{ docker_nodeexporter_port }}:9100