summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-08-26 08:48:58 +0100
committerJoe Carstairs <me@joeac.net>2026-08-26 08:49:14 +0100
commit1837f2c9b1a00ce2d50ebb5f8c63032993a5d000 (patch)
treeae6d55104d5506aa25c4b5e173fd7f49168662a4 /roles
parentdcab47136092d056f1729f004b81e0093106852c (diff)
etherpad auto-updates
Diffstat (limited to 'roles')
-rw-r--r--roles/etherpad/tasks/main.yml12
-rw-r--r--roles/etherpad/templates/update_etherpad12
2 files changed, 24 insertions, 0 deletions
diff --git a/roles/etherpad/tasks/main.yml b/roles/etherpad/tasks/main.yml
index 185fe51..9575ce9 100644
--- a/roles/etherpad/tasks/main.yml
+++ b/roles/etherpad/tasks/main.yml
@@ -63,3 +63,15 @@
name: etherpad
enabled: true
state: started
+
+- name: Install script to update etherpad
+ ansible.builtin.template:
+ src: update_etherpad
+ dest: /usr/bin/update_etherpad
+ mode: "755"
+
+- name: Install daily crontab to update etherpad
+ ansible.builtin.cron:
+ special_time: daily
+ name: Update etherpad
+ job: /usr/bin/update_etherpad
diff --git a/roles/etherpad/templates/update_etherpad b/roles/etherpad/templates/update_etherpad
new file mode 100644
index 0000000..9268d5a
--- /dev/null
+++ b/roles/etherpad/templates/update_etherpad
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+cd {{ src_dir }}/etherpad
+prev_commit="$(git status --oneline -n 1 | cut -c1-7)"
+git pull
+new_commit="$(git status --oneline -n 1 | cut -c1-7)"
+if [ "$prev_commit" != "$new_commit" ]
+then
+ pnpm install
+ pnpm run build:ui
+ rc-service etherpad restart
+fi