Files
iac-homelab/ansible/roles/dnsmasq_exporter/tasks/main.yml
2025-06-21 08:28:10 +02:00

57 lines
1.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
# ================================================================
# Rôle : dnsmasq_exporter
# Tâches principales
#
# Objectif : Installer la dernière version de dnsmasq_exporter
# via `go install` et la lancer comme service systemd.
#
# Remarque : cette implémentation reste volontairement simple.
# - Aucune gestion fine de la version : toujours la « latest ».
# - Repose sur le paquet Debian/Ubuntu `golang`.
# - Le binaire est installé directement dans /usr/local/bin
# grâce à la variable denvironnement GOBIN.
# ================================================================
- name: "[dnsmasq_exporter] Dépendances build (golang, git)"
ansible.builtin.apt:
name:
- golang-go
- git
state: present
update_cache: true
tags:
- dnsmasq_exporter
- install
- name: "[dnsmasq_exporter] Installation du binaire (go install @latest)"
ansible.builtin.command:
cmd: go install github.com/google/dnsmasq_exporter@latest
creates: /usr/local/bin/dnsmasq_exporter
environment:
GOBIN: /usr/local/bin
tags:
- dnsmasq_exporter
- build
- name: "[dnsmasq_exporter] Déploiement du service systemd"
ansible.builtin.template:
src: dnsmasq_exporter.service.j2
dest: /etc/systemd/system/dnsmasq_exporter.service
owner: root
group: root
mode: "0644"
notify: Reload systemd
tags:
- dnsmasq_exporter
- config
- name: "[dnsmasq_exporter] Activation et démarrage du service"
ansible.builtin.service:
name: dnsmasq_exporter
state: started
enabled: true
tags:
- dnsmasq_exporter
- service