]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Adding Ansible role haproxy-enable-backend
authorFrank Brehm <frank.brehm@pixelpark.com>
Wed, 18 Dec 2024 14:32:21 +0000 (15:32 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Wed, 18 Dec 2024 14:32:21 +0000 (15:32 +0100)
roles/haproxy-disable-backend/tasks/main.yaml
roles/haproxy-enable-backend/defaults/main.yaml [new file with mode: 0644]
roles/haproxy-enable-backend/tasks/main.yaml [new file with mode: 0644]

index 7955b1c7b17610f42bb06ab119ba17393b194dcf..1920c143c834f145184aa738b2ed20dc77b8524e 100644 (file)
@@ -14,5 +14,4 @@
     wait_interval: "{{ haproxy_wait_interval }}"
     wait_retries: "{{ haproxy_wait_retries }}"
 
-
 # vim: filetype=yaml
diff --git a/roles/haproxy-enable-backend/defaults/main.yaml b/roles/haproxy-enable-backend/defaults/main.yaml
new file mode 100644 (file)
index 0000000..28fc86b
--- /dev/null
@@ -0,0 +1,11 @@
+---
+
+haproxy_user_socket: '/run/haproxy/user.sock'
+haproxy_admin_socket: '/run/haproxy/admin.sock'
+haproxy_test_socket: '/etc/passwd'
+
+haproxy_wait_for_enable: true
+haproxy_wait_interval: 2
+haproxy_wait_retries: 60
+
+# vim: filetype=yaml
diff --git a/roles/haproxy-enable-backend/tasks/main.yaml b/roles/haproxy-enable-backend/tasks/main.yaml
new file mode 100644 (file)
index 0000000..f9d484e
--- /dev/null
@@ -0,0 +1,17 @@
+---
+
+- debug:
+    msg: "Enabling server '{{ backend_server }}' on HAProxy backend '{{ backend }}' ..."
+    verbosity: 0
+
+- name: "Enabling backend server {{ backend }}/{{ backend_server }}."
+  community.general.haproxy:
+    state: enabled
+    host: "{{ backend_server }}"
+    socket: "{{ haproxy_admin_socket }}"
+    backend: "{{ backend }}"
+    wait: "{{ haproxy_wait_for_enable }}"
+    wait_interval: "{{ haproxy_wait_interval }}"
+    wait_retries: "{{ haproxy_wait_retries }}"
+
+# vim: filetype=yaml