From 1c47ccc4a8a354d6465f453594676dc0c1a25705 Mon Sep 17 00:00:00 2001 From: Jeltz Date: Wed, 21 Dec 2022 19:48:22 +0100 Subject: [PATCH] bird: install prometheus-bird-exporter --- roles/bird/defaults/main.yml | 1 + roles/bird/handlers/main.yml | 6 ++++++ roles/bird/tasks/main.yml | 21 ++++++++++++++++++- .../templates/prometheus-bird-exporter.j2 | 3 +++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 roles/bird/templates/prometheus-bird-exporter.j2 diff --git a/roles/bird/defaults/main.yml b/roles/bird/defaults/main.yml index 68e90f2..1c72633 100644 --- a/roles/bird/defaults/main.yml +++ b/roles/bird/defaults/main.yml @@ -11,4 +11,5 @@ bird__radv_dns_servers: [] bird__radv_max_interval: 5 bird__static_unreachable: [] bird__bgp_sessions: [] +bird__prometheus_listen_address: 0.0.0.0:9324 ... diff --git a/roles/bird/handlers/main.yml b/roles/bird/handlers/main.yml index 7de17ff..2b17b11 100644 --- a/roles/bird/handlers/main.yml +++ b/roles/bird/handlers/main.yml @@ -3,4 +3,10 @@ systemd: name: bird.service state: reloaded + +- name: Reload prometheus-bird-exporter + systemd: + name: prometheus-bird-exporter.service + state: reloaded +... ... diff --git a/roles/bird/tasks/main.yml b/roles/bird/tasks/main.yml index 4b896ef..0f7bda1 100644 --- a/roles/bird/tasks/main.yml +++ b/roles/bird/tasks/main.yml @@ -1,7 +1,9 @@ --- - name: Install bird apt: - name: bird2 + name: + - bird2 + - prometheus-bird-exporter - name: Configure bird template: @@ -13,9 +15,26 @@ notify: - Reload bird +- name: Configure prometheus-bird-exporter + template: + src: prometheus-bird-exporter.j2 + dest: /etc/default/prometheus-bird-exporter + owner: root + group: root + mode: u=rw,g=r,o= + notify: + - Restart prometheus-bird-exporter + - name: Enable and start bird systemd: name: bird.service state: started enabled: true + +- name: Enable and start prometheus-bird-exporter + systemd: + name: prometheus-bird-exporter.service + state: started + enabled: true + ... diff --git a/roles/bird/templates/prometheus-bird-exporter.j2 b/roles/bird/templates/prometheus-bird-exporter.j2 new file mode 100644 index 0000000..86006b0 --- /dev/null +++ b/roles/bird/templates/prometheus-bird-exporter.j2 @@ -0,0 +1,3 @@ +{{ ansible_managed | comment }} + +ARGS="-format.new -bird.v2 -web.listen-address {{ bird__prometheus_listen_address }}"