Skip to content

Commit

Permalink
Haproxy_mgnt: Add option to use docker backends
Browse files Browse the repository at this point in the history
  • Loading branch information
quartje committed Nov 27, 2023
1 parent 7427510 commit 1615a88
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions library/haproxy_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def _haproxy_state(host, state, app_name):
"php_blauwrood_servers": {"php_blauwrood_servers": True, "type": "list"},
"static_blauwrood_servers": {"static_blauwrood_servers": True, "type": "list"},
"stepup_blauwrood_servers": {"stepup_blauwrood_servers": True, "type": "list"},
"docker_blauwrood_servers": {"docker_blauwrood_servers": True, "type": "list"},
"weight": {"type": "str"},
"color": {"required": True, "type": "str"},
"app_name": {"required": True, "type": "str"},
Expand All @@ -32,6 +33,7 @@ def _haproxy_state(host, state, app_name):
php_servers = [s["label"] for s in module.params["php_blauwrood_servers"]]
static_servers = [s["label"] for s in module.params["static_blauwrood_servers"]]
stepup_servers = [s["label"] for s in module.params["stepup_blauwrood_servers"]]
docker_servers = [s["label"] for s in module.params["docker_blauwrood_servers"]]
app_name = module.params["app_name"].lower()
app_type = module.params["app_type"].lower()

Expand All @@ -48,6 +50,8 @@ def _haproxy_state(host, state, app_name):
servers = static_servers
elif app_type == "stepup":
servers = stepup_servers
elif app_type == "docker":
servers = docker_servers

red_servers = [s for s in servers if s.upper().endswith("ROOD")]
blue_servers = [s for s in servers if s.upper().endswith("BLAUW")]
Expand Down
2 changes: 2 additions & 0 deletions roles/haproxy_mgnt/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
php_blauwrood_servers: "{{ php_blauwrood_servers }}"
static_blauwrood_servers: "{{ static_blauwrood_servers }}"
stepup_blauwrood_servers: "{{ stepup_blauwrood_servers }}"
docker_blauwrood_servers: "{{ docker_blauwrood_servers }}"
weight: "{{ weight }}"
color: "{{ color }}"
app_name: "{{ app_name }}"
Expand All @@ -30,6 +31,7 @@
php_blauwrood_servers: "{{ php_blauwrood_servers }}"
static_blauwrood_servers: "{{ static_blauwrood_servers }}"
stepup_blauwrood_servers: "{{ stepup_blauwrood_servers }}"
docker_blauwrood_servers: "{{ docker_blauwrood_servers }}"
color: "{{ color }}"
state: "{{ state }}"
app_name: "{{ app_name }}"
Expand Down

0 comments on commit 1615a88

Please sign in to comment.