-
Notifications
You must be signed in to change notification settings - Fork 2
/
timer.sls
49 lines (42 loc) · 1.31 KB
/
timer.sls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{% from "gitops/defaults.jinja" import settings with context %}
include:
- gitops.service
{% if settings.timer.enabled|d(false) %}
/etc/systemd/system/gitops-update.timer:
file.managed:
- source: salt://gitops/gitops-update.timer
- template: jinja
- defaults:
settings: {{ settings }}
cmd.run:
- name: systemctl daemon-reload
- onchanges:
- file: /etc/systemd/system/gitops-update.timer
service.running:
- name: gitops-update.timer
- enable: true
- require:
- file: /usr/local/sbin/gitops-update.sh
- file: /etc/systemd/system/gitops-update.service
- file: /etc/systemd/system/gitops-update.timer
- watch:
- file: /etc/systemd/system/gitops-update.service
- file: /etc/systemd/system/gitops-update.timer
{% else %}
disable-gitops-update.timer:
cmd.run:
- name: systemctl disable gitops-update.timer || true
- onlyif: systemctl is-enabled gitops-update.timer
stop-gitops-update.timer:
cmd.run:
- name: systemctl stop gitops-update.timer || true
- onlyif: systemctl is-active gitops-update.timer
/etc/systemd/system/gitops-update.timer:
file.symlink:
- target: /dev/null
- force: true
cmd.run:
- name: systemctl daemon-reload
- onchanges:
- file: /etc/systemd/system/gitops-update.timer
{%- endif %}