ansible-pull(role): make successful run timestamp exporter work

The successful run timestamp exporter didn't work, because the
ansible-pull user wouldn't necessarily have the necessary permissions
and because the command wouldn't properly work.
Move the timestamp export as well as the reboot to separate services,
which always run as root, to ensure these operations work and to have a
clean setup using systemd services.
Also move the successful run timestamp exporter to a custom script to
have it work properly.
This commit is contained in:
June 2026-11-04 17:28:03 +01:00
commit 1157c98ff5
Signed by: june
SSH key fingerprint: SHA256:o9EAq4Y9N9K0pBQeBTqhSDrND5E7oB+60ZNx0U1yPe0

View file

@ -24,6 +24,17 @@
virtualenv: /usr/local/lib/ansible_pull_venv
become: true
- name: ensure helper script installations exist
ansible.builtin.copy:
src: "{{ item }}.sh"
dest: "/usr/local/sbin/{{ item }}"
owner: root
group: root
mode: "0755"
become: true
loop:
- ansible-pull-successful-run-timestamp-exporter
- name: ensure ansible-pull-failure-notify script installation exists
ansible.builtin.template:
src: ansible-pull-failure-notify.sh.j2
@ -51,7 +62,7 @@
group: "{{ ansible_pull__user }}"
become: true
- name: ensure systemd services exists
- name: ensure templated systemd services exists
ansible.builtin.template:
src: "{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
@ -65,6 +76,20 @@
notify:
- systemd daemon reload
- name: ensure systemd services exists
ansible.builtin.copy:
src: "{{ item }}"
dest: "/etc/systemd/system/{{ item }}"
owner: root
group: root
mode: "0644"
become: true
loop:
- ansible-pull-reboot.service
- ansible-pull-successful-run-timestamp-exporter.service
notify:
- systemd daemon reload
- name: ensure systemd timer exists
ansible.builtin.template:
src: ansible-pull.timer.j2