summaryrefslogtreecommitdiff
path: root/playbooks/roles/keepalived/templates/healthcheck.sh.j2
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks/roles/keepalived/templates/healthcheck.sh.j2')
-rw-r--r--playbooks/roles/keepalived/templates/healthcheck.sh.j212
1 files changed, 12 insertions, 0 deletions
diff --git a/playbooks/roles/keepalived/templates/healthcheck.sh.j2 b/playbooks/roles/keepalived/templates/healthcheck.sh.j2
new file mode 100644
index 0000000..0e6c18b
--- /dev/null
+++ b/playbooks/roles/keepalived/templates/healthcheck.sh.j2
@@ -0,0 +1,12 @@
+#!/bin/bash
+set -e
+PING_HOSTNAME="{{ traefik_host }}"
+VIRTUAL_IP="{{ keepalived_virtual_ip }}"
+
+function do_ping() {
+ local endpoint_hostname="$1"
+ local vip="$2"
+ curl -s -o /dev/null -w "%{http_code}" --resolve "$endpoint_hostname:443:$vip" "https://$endpoint_hostname/ping"
+}
+
+test "$(do_ping "$PING_HOSTNAME" "$VIRTUAL_IP")" = "200"