From 54b59472a146cdad652f6cefcbdaece0f0f89e74 Mon Sep 17 00:00:00 2001 From: Ahmed Abdelhalim Date: Wed, 24 Jun 2026 03:35:43 +0200 Subject: Add garage health check before provisioning keys --- molecule/raspberrypi/converge.yml | 4 ++-- roles/garage/meta/main.yml | 3 ++- roles/garage/templates/garage-provision.sh.j2 | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/molecule/raspberrypi/converge.yml b/molecule/raspberrypi/converge.yml index 6887ff10..023d7154 100644 --- a/molecule/raspberrypi/converge.yml +++ b/molecule/raspberrypi/converge.yml @@ -92,6 +92,8 @@ - role: "prometheus" - role: "prometheus-node-exporter" - role: "grafana" + - role: "backup" + - role: "garage" - role: "gnome" - role: "gnome-calendar" - role: "gnome-loupe" @@ -115,5 +117,3 @@ - role: "pipewire" - role: "claude" - role: "localsend" - - role: "backup" - - role: "garage" diff --git a/roles/garage/meta/main.yml b/roles/garage/meta/main.yml index e59db6e0..3efdd4e7 100644 --- a/roles/garage/meta/main.yml +++ b/roles/garage/meta/main.yml @@ -1,5 +1,6 @@ --- -dependencies: [] +dependencies: + - role: "curl" galaxy_info: author: "a14m" description: "Install Garage S3-compatible object store" diff --git a/roles/garage/templates/garage-provision.sh.j2 b/roles/garage/templates/garage-provision.sh.j2 index 0402c926..1360c486 100644 --- a/roles/garage/templates/garage-provision.sh.j2 +++ b/roles/garage/templates/garage-provision.sh.j2 @@ -3,10 +3,11 @@ set -e GARAGE="garage -c /etc/garage/garage.toml" -if ! $GARAGE layout show 2>/dev/null | grep -q "Current cluster layout"; then - NODE_ID=$($GARAGE node id -q | cut -d@ -f1) +NODE_ID=$($GARAGE node id -q | cut -d@ -f1) +if ! $GARAGE layout show 2>/dev/null | grep -q "$NODE_ID"; then $GARAGE layout assign --zone dc1 --capacity {{ garage_capacity }} "$NODE_ID" $GARAGE layout apply --version 1 + curl -sf --retry 30 --retry-delay 1 --retry-all-errors http://127.0.0.1:{{ garage_admin_port }}/health fi if ! $GARAGE bucket list | grep -q "{{ garage_bucket }}"; then -- cgit v1.2.3