From b69020661d17e0e97123cd451078879bce9df78f Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 18 Dec 2024 15:32:21 +0100 Subject: [PATCH] Adding Ansible role haproxy-enable-backend --- roles/haproxy-disable-backend/tasks/main.yaml | 1 - roles/haproxy-enable-backend/defaults/main.yaml | 11 +++++++++++ roles/haproxy-enable-backend/tasks/main.yaml | 17 +++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 roles/haproxy-enable-backend/defaults/main.yaml create mode 100644 roles/haproxy-enable-backend/tasks/main.yaml 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 -- 2.39.5