ansible-pull(role): export last successful run timestamp statistic
All checks were successful
/ build (pull_request) Successful in 31s
/ Ansible Lint (push) Successful in 3m14s
/ Ansible Lint (pull_request) Successful in 2m51s
/ cleanup-staging (pull_request) Successful in 43s

Using the node exporter textfile collector, expose the timestamp of the
last successful ansible-pull run.
This commit is contained in:
June 2026-11-03 02:13:41 +01:00
commit 104f0ff8d2
Signed by: june
SSH key fingerprint: SHA256:o9EAq4Y9N9K0pBQeBTqhSDrND5E7oB+60ZNx0U1yPe0

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'