summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-08-26 09:37:14 +0100
committerJoe Carstairs <me@joeac.net>2026-08-26 09:37:33 +0100
commit29c1c4c8afc41303d00cde10950d42129c7c0f33 (patch)
tree43d209abf8a81b81b63a8b77361c26223558e496
parent7a17fe4dcee235b5973326c6daedebccc2de41d2 (diff)
fcgiwrap is self-updating
-rw-r--r--playbook.yml1
-rw-r--r--roles/fcgiwrap/files/update_fcgiwrap18
-rw-r--r--roles/fcgiwrap/tasks/main.yml40
-rw-r--r--roles/fcgiwrap/templates/conf.d/fcgiwrap (renamed from roles/git/templates/conf.d/fcgiwrap)0
-rw-r--r--roles/git/tasks/main.yml28
5 files changed, 60 insertions, 27 deletions
diff --git a/playbook.yml b/playbook.yml
index 3657033..c9a1444 100644
--- a/playbook.yml
+++ b/playbook.yml
@@ -39,6 +39,7 @@
become: true
roles:
- nginx
+ - fcgiwrap
- git
vars_files:
- common.yml
diff --git a/roles/fcgiwrap/files/update_fcgiwrap b/roles/fcgiwrap/files/update_fcgiwrap
new file mode 100644
index 0000000..f371b5d
--- /dev/null
+++ b/roles/fcgiwrap/files/update_fcgiwrap
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+apk upgrade
+
+fcgiwrap_pid="$(pgrep fcgiwrap | head -n 1)"
+if [ -z "$fcgiwrap_pid" ]
+then
+ rc-service fcgiwrap restart
+ exit 0
+fi
+
+fcgiwrap_proc_start_time="$(stat -Lc %Y /proc/${fcgiwrap_pid})"
+fcgiwrap_file_mtime="$(stat -Lc %Y $(which fcgiwrap))"
+
+if [ "$fcgiwrap_file_mtime" -gt "$fcgiwrap_proc_start_time" ]
+then
+ rc-service fcgiwrap restart
+fi
diff --git a/roles/fcgiwrap/tasks/main.yml b/roles/fcgiwrap/tasks/main.yml
new file mode 100644
index 0000000..7435274
--- /dev/null
+++ b/roles/fcgiwrap/tasks/main.yml
@@ -0,0 +1,40 @@
+- name: Install fcgiwrap
+ community.general.apk:
+ name: fcgiwrap
+
+- name: Configure fcgiwrap daemon
+ register: fcgiwrap_conf
+ vars:
+ fcgiwrap_socket: /run/fcgiwrap.sock
+ fcgiwrap_user: nginx
+ fcgiwrap_group: nginx
+ ansible.builtin.template:
+ src: conf.d/fcgiwrap
+ dest: /etc/conf.d/fcgiwrap
+ mode: "644"
+
+- name: Restart fcgiwrap daemon and configure to start on boot
+ when: fcgiwrap_conf is changed
+ ansible.builtin.service:
+ name: fcgiwrap
+ enabled: true
+ state: restarted
+
+- name: Start fcgiwrap daemon and configure to start on boot
+ when: not ( fcgiwrap_conf is changed )
+ ansible.builtin.service:
+ name: fcgiwrap
+ enabled: true
+ state: started
+
+- name: Install script to update fcgiwrap
+ ansible.builtin.template:
+ src: update_fcgiwrap
+ dest: /usr/bin/update_fcgiwrap
+ mode: "755"
+
+- name: Install daily crontab to update fcgiwrap
+ ansible.builtin.cron:
+ special_time: daily
+ name: Update fcgiwrap
+ job: /usr/bin/update_fcgiwrap
diff --git a/roles/git/templates/conf.d/fcgiwrap b/roles/fcgiwrap/templates/conf.d/fcgiwrap
index 65a40e8..65a40e8 100644
--- a/roles/git/templates/conf.d/fcgiwrap
+++ b/roles/fcgiwrap/templates/conf.d/fcgiwrap
diff --git a/roles/git/tasks/main.yml b/roles/git/tasks/main.yml
index fffca7c..da4bbf2 100644
--- a/roles/git/tasks/main.yml
+++ b/roles/git/tasks/main.yml
@@ -1,8 +1,7 @@
-- name: Install cgit, fcgiwrap, git, and shadow
+- name: Install cgit, git, and shadow
community.general.apk:
name:
- cgit
- - fcgiwrap
- git
- shadow
@@ -42,31 +41,6 @@
state: link
mode: "750"
-- name: Configure fcgiwrap daemon
- register: fcgiwrap_conf
- vars:
- fcgiwrap_socket: /run/fcgiwrap.sock
- fcgiwrap_user: nginx
- fcgiwrap_group: nginx
- ansible.builtin.template:
- src: conf.d/fcgiwrap
- dest: /etc/conf.d/fcgiwrap
- mode: "644"
-
-- name: Restart fcgiwrap daemon and configure to start on boot
- when: fcgiwrap_conf is changed
- ansible.builtin.service:
- name: fcgiwrap
- enabled: true
- state: restarted
-
-- name: Start fcgiwrap daemon and configure to start on boot
- when: not ( fcgiwrap_conf is changed )
- ansible.builtin.service:
- name: fcgiwrap
- enabled: true
- state: started
-
- name: Install htpasswd file
ansible.builtin.copy:
src: htpasswd