summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2025-05-27 11:00:22 +0200
committerGuilhem Moulin <guilhem@fripost.org>2025-05-27 11:02:38 +0200
commit614746b59e6a1af59f453703037452307d5444fe (patch)
tree656f568d4b1d830d40b90c557c359cf211090e1c
parent420f1a59d6cad99549364e699200edd659bb5b2e (diff)
webmap-update@.timer: Add ability to adjust calendar events for individual template units.
Via group variables. For instance mineralrattigheter.zip is updated daily at 04:33 CEST, so we trigger the units after that to avoid being off by a day. (Also that particular unit runs relatively fast and should have terminated by the start of office hours.)
-rw-r--r--group_vars/all.yml4
-rw-r--r--tasks/webmap.yml16
-rw-r--r--templates/etc/systemd/system/webmap-update@.timer.d/override.conf.j23
3 files changed, 23 insertions, 0 deletions
diff --git a/group_vars/all.yml b/group_vars/all.yml
index e90c73e..247e518 100644
--- a/group_vars/all.yml
+++ b/group_vars/all.yml
@@ -14,6 +14,10 @@ webmap_layer_groups:
webmap_layer_groups_nodownload:
- misc
+# adjust calendar events for individual units
+webmap_layer_groups_update_calendar:
+ mrr: "*-*-* 05:00:00" # updated daily at 04:33 CEST
+
# PostgreSQL's version number and cluster name
postgresql:
version: 15
diff --git a/tasks/webmap.yml b/tasks/webmap.yml
index d694387..de320d4 100644
--- a/tasks/webmap.yml
+++ b/tasks/webmap.yml
@@ -69,6 +69,22 @@
notify:
- systemctl daemon-reload
+- name: Create directory /etc/systemd/system/webmap-update@*.timer.d
+ file: path=/etc/systemd/system/webmap-update@{{ item }}.timer.d
+ state=directory
+ owner=root group=root
+ mode=0755
+ with_items: "{{ webmap_layer_groups_update_calendar.keys() | list }}"
+
+- name: Copy /etc/systemd/system/webmap-update@*.timer.d/override.conf
+ template: src=etc/systemd/system/webmap-update@.timer.d/override.conf.j2
+ dest=/etc/systemd/system/webmap-update@{{ item }}.timer.d/override.conf
+ owner=root group=root
+ mode=0644
+ with_items: "{{ webmap_layer_groups_update_calendar.keys() | list }}"
+ notify:
+ - systemctl daemon-reload
+
- name: Enable webmap-update.timer
service: name=webmap-update@{{ item }}.timer state=started enabled=true
with_items: "{{ webmap_layer_groups }}"
diff --git a/templates/etc/systemd/system/webmap-update@.timer.d/override.conf.j2 b/templates/etc/systemd/system/webmap-update@.timer.d/override.conf.j2
new file mode 100644
index 0000000..795ee20
--- /dev/null
+++ b/templates/etc/systemd/system/webmap-update@.timer.d/override.conf.j2
@@ -0,0 +1,3 @@
+[Timer]
+OnCalendar=
+OnCalendar={{ webmap_layer_groups_update_calendar[item] }}