From: Frank Brehm Date: Wed, 18 Dec 2024 14:32:21 +0000 (+0100) Subject: Adding Ansible role haproxy-enable-backend X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=b69020661d17e0e97123cd451078879bce9df78f;p=pixelpark%2Fpp-admin-tools.git Adding Ansible role haproxy-enable-backend --- diff --git a/roles/haproxy-disable-backend/tasks/main.yaml b/roles/haproxy-disable-backend/tasks/main.yaml index 7955b1c..1920c14 100644 --- a/roles/haproxy-disable-backend/tasks/main.yaml +++ b/roles/haproxy-disable-backend/tasks/main.yaml @@ -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 index 0000000..28fc86b --- /dev/null +++ b/roles/haproxy-enable-backend/defaults/main.yaml @@ -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 index 0000000..f9d484e --- /dev/null +++ b/roles/haproxy-enable-backend/tasks/main.yaml @@ -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