ansible-infra/roles/ansible_pull/templates/ansible-pull.service.j2
June a48644701b
Some checks failed
/ Ansible Lint (push) Failing after 47s
/ Ansible Lint (pull_request) Failing after 47s
ansible_pull(role): add ExecStartPost step rebooting the hosts, if nec.
Add ExecStartPost step rebooting the hosts, if necessary.
2025-10-13 17:17:26 +02:00

18 lines
811 B
Django/Jinja

[Unit]
Description=ansible-pull for configuration and maintenance
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
Environment="SOPS_AGE_KEY_FILE=/etc/ansible_pull_secrets/age_private_key"
ExecStart=/usr/local/lib/ansible_pull_venv/bin/ansible-pull \
--directory /home/chaos/ansible_pull_checkout \
--clean \
--url "{{ ansible_pull__repo_url }}" \
--checkout "{{ ansible_pull__checkout }}" \
--inventory "{{ ansible_pull__inventory }}" \
"{{ ansible_pull__playbook }}"
User={{ ansible_pull__user }}
# Reboot, if /var/run/reboot-required or /var/run/ansible-reboot-required exist.
ExecStartPost=/usr/bin/bash 'if [ -e /var/run/reboot-required ] || [ -e /var/run/ansible-reboot-required ]; then sudo systemctl reboot; fi'