FEATURE: systemd unit and timer added to schedule and run maintenance playbook
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Run Ansible playbook for daily maintenance
|
||||||
|
After=network-online.target
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
# CAHNGE TO MATCH YOUR REQUIREMENTS
|
||||||
|
User=max
|
||||||
|
Group=max
|
||||||
|
WorkingDirectory=/home/max/projects/ansible_home
|
||||||
|
ExecStart=/home/max/projects/ansible_home/run_playbook.sh /home/max/projects/ansible_home/playbooks/maintain.yaml
|
||||||
|
StandardOutput=journal
|
||||||
|
StandardError=journal
|
||||||
|
# Optional: prevent runaway if the playbook hangs
|
||||||
|
TimeoutStopSec=3600
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Timer for daily Ansible playbook
|
||||||
|
Requires=ansible-maintenance.service
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnUnitActiveSec=10min
|
||||||
|
Persistent=true
|
||||||
|
Unit=ansible-maintenance.service
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
Reference in New Issue
Block a user