Compare commits

..
Author SHA1 Message Date
b3633ed0e4 Update docker.io/library/postgres Docker tag to v14
All checks were successful
/ build (pull_request) Successful in 30s
/ Ansible Lint (pull_request) Successful in 3m13s
/ Ansible Lint (push) Successful in 3m56s
2026-11-03 20:16:43 +00:00
f6f6cc4804 ansible-pull(role): export last successful run timestamp statistic
All checks were successful
/ build (push) Successful in 31s
/ Ansible Lint (push) Successful in 2m39s
Using the node exporter textfile collector, expose the timestamp of the
last successful ansible-pull run.
2026-11-03 19:58:03 +01:00
52d3d8ecd9 alloy(role): enable node exporter textfile collector
Enable the node exporter textfile collector, which allows for collecting
custom statistics in a simple way.
https://github.com/prometheus/node_exporter#textfile-collector
2026-11-03 19:58:03 +01:00
4 changed files with 17 additions and 2 deletions

View file

@ -50,7 +50,10 @@ alloy_config_default: |
}
prometheus.exporter.unix "local_system" {
enable_collectors = ["systemd"]
enable_collectors = ["systemd", "textfile"]
textfile {
directory = "/var/lib/node_exporter_textfile/"
}
}
prometheus.scrape "scrape_metrics" {

View file

@ -50,7 +50,10 @@ alloy_config_default: |
}
prometheus.exporter.unix "local_system" {
enable_collectors = ["systemd"]
enable_collectors = ["systemd", "textfile"]
textfile {
directory = "/var/lib/node_exporter_textfile/"
}
}
prometheus.scrape "scrape_metrics" {

View file

@ -1,6 +1,14 @@
---
- name: Deploy Grafana Alloy with config
block:
- name: Create directory for node_exporter textfile collector
ansible.builtin.file:
path: /var/lib/node_exporter_textfile
state: directory
mode: "0755"
owner: root
group: root
- name: Install Alloy
ansible.builtin.include_tasks: install.yaml

View file

@ -19,5 +19,6 @@ ExecStart=/usr/local/lib/ansible_pull_venv/bin/ansible-pull \
--inventory "{{ ansible_pull__inventory }}" \
"{{ ansible_pull__playbook }}"
User={{ ansible_pull__user }}
ExecStartPost=/usr/bin/bash -c 'echo "ansible_pull_last_successful_run_timestamp_seconds $(date +%s)" > /var/lib/node_exporter_textfile/ansible_pull.prom.$$; mv /var/lib/node_exporter_textfile/ansible_pull.prom.$$ /var/lib/node_exporter_textfile/ansible_pull.prom'
# Reboot, if /var/run/reboot-required or /var/run/ansible-reboot-required exist.
ExecStartPost=/usr/bin/bash -c 'if [ -e /var/run/reboot-required ] || [ -e /var/run/ansible-reboot-required ]; then sudo systemctl reboot; fi'