diff --git a/deploy.yaml b/deploy.yaml index 6a23576..eda80d1 100644 --- a/deploy.yaml +++ b/deploy.yaml @@ -59,6 +59,19 @@ loop: - local-data.conf - noc.conf + + # Unbound exporter installed with go as the unbound_exporter user using: + # go install github.com/letsencrypt/unbound_exporter@latest + # to /home/unbound_exporter/go/unbound_exporter + - name: deploy unbound exporter service + ansible.builtin.copy: + src: "resources/resolv-dns/files/unbound-exporter.service" + dest: "/etc/systemd/system/unbound-exporter.service" + owner: root + group: root + mode: "0644" + become: true + notify: Restart Unbound exporter service handlers: - name: Restart Unbound @@ -66,3 +79,10 @@ name: unbound state: restarted become: true + + - name: Restart Unbound exporter service + ansible.builtin.systemd_service: + name: unbound-exporter + state: restarted + daemon_reload: true + become: true diff --git a/resources/resolv-dns/files/unbound-exporter.service b/resources/resolv-dns/files/unbound-exporter.service new file mode 100644 index 0000000..cc7a7a1 --- /dev/null +++ b/resources/resolv-dns/files/unbound-exporter.service @@ -0,0 +1,17 @@ +[Unit] +Description=Prometheus exporter for Unbound metrics, written in Go with pluggable metric collectors. The metrics exporter converts Unbound metric names to Prometheus metric names and labels by using a set of regular expressions. +Documentation=https://github.com/letsencrypt/unbound_exporter +After=network.target + +[Service] +Type=simple +ExecStart=/home/unbound_exporter/go/bin/unbound_exporter \ + -unbound.ca "" \ + -unbound.cert "" \ + -unbound.key "" \ + -unbound.host "unix:///run/unbound.ctl" +User=unbound_exporter +Group=unbound + +[Install] +WantedBy=multi-user.target