Adding auto upgrade service

This commit is contained in:
Tyler Hale 2024-09-20 11:37:43 -06:00
parent 424dc8051f
commit f1eeff4785
Signed by: Tyler
GPG key ID: C7CC4B910D88EF96
3 changed files with 34 additions and 0 deletions

View file

@ -289,3 +289,20 @@
name: nginx
state: started
enabled: yes
- name: Deploy snipeit upgrade service
template:
src: snipeit-upgrade.service.j2
dest: /etc/systemd/system/snipeit-upgrade.service
notify: Daemon Reload
- name: Deploy snipeit upgrade timer
template:
src: snipeit-upgrade.timer.j2
dest: /etc/systemd/system/snipeit-upgrade.timer
notify: Daemon Reload
- name: Enable systemd timer for snipeit upgrade
service:
name: snipeit-upgrade.timer
enabled: yes

View file

@ -0,0 +1,8 @@
[Unit]
Description=SnipeIt Auto Upgrade Service
[Service]
Type=oneshot
WorkingDirectory=/opt/snipeit
User={{ ansible_user }}
Group={{ ansible_user }}
ExecStart=/bin/bash -c 'git pull && php composer.phar update --no-interaction && php upgrade.php --no-interactive'

View file

@ -0,0 +1,9 @@
[Unit]
Description=SnipeIt Renewal Timer
[Timer]
WakeSystem=false
OnCalendar=Sat *-*-* 05:00
RandomizedDelaySec=600
[Install]
WantedBy=timers.target