The successful run timestamp export didn't work, because the ansible-pull user wouldn't necessarily have the necessary permissions. Move the timestamp export as well as the reboot to separate services, which always run as root, to ensure these operations work.
8 lines
413 B
Desktop File
8 lines
413 B
Desktop File
[Unit]
|
|
Description=ansible-pull successful run timestamp exporter
|
|
After=ansible-pull.service
|
|
Before=ansible-pull-reboot.service
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
ExecStart=/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'
|