Allow the haproxy configuration to run with limited groups

The haproxy config we have makes a couple assumptions about groups being
present. this change simply improves our existing config so that it
works should a deployer omit common groups within a deployment.

Change-Id: Iae3798c98c250e959f660603263405aa88a4e1a1
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2017-11-18 19:53:09 -06:00 committed by Kevin Carter (cloudnull)
parent fdf33902c2
commit 656fd476f2

View File

@ -40,8 +40,8 @@ haproxy_opendaylight_whitelist_networks: "{{ haproxy_whitelist_networks }}"
haproxy_default_services:
- service:
haproxy_service_name: galera
haproxy_backend_nodes: "{{ [groups['galera_all'][0]] | default([]) }}" # list expected
haproxy_backup_nodes: "{{ groups['galera_all'][1:] | default([]) }}"
haproxy_backend_nodes: "{{ (groups['galera_all'] | default([]))[:1] }}" # list expected
haproxy_backup_nodes: "{{ (groups['galera_all'] | default([]))[1:] }}"
haproxy_bind: "{{ [internal_lb_vip_address] }}"
haproxy_port: 3306
haproxy_balance_type: tcp
@ -69,8 +69,8 @@ haproxy_default_services:
- "httpchk HEAD /"
- service:
haproxy_service_name: repo_cache
haproxy_backend_nodes: "{{ [groups['repo_all'][0]] | default([]) }}" # list expected
haproxy_backup_nodes: "{{ groups['repo_all'][1:] | default([]) }}"
haproxy_backend_nodes: "{{ (groups['repo_all'] | default([]))[:1] }}" # list expected
haproxy_backup_nodes: "{{ (groups['repo_all'] | default([]))[1:] }}"
haproxy_bind: "{{ [internal_lb_vip_address] }}"
haproxy_port: "{{ repo_pkg_cache_port }}"
haproxy_balance_type: http
@ -182,7 +182,7 @@ haproxy_default_services:
haproxy_service_name: nova_console
haproxy_backend_nodes: "{{ groups['nova_console'] | default([]) }}"
haproxy_ssl: "{{ haproxy_ssl }}"
haproxy_port: "{{ hostvars[groups['nova_console'][0]]['nova_console_port'] }}"
haproxy_port: "{{ hostvars[(groups['nova_console'] | default(['localhost']))[0] | default('localhost')]['nova_console_port'] | default(6082) }}"
haproxy_balance_type: http
haproxy_timeout_client: 60m
haproxy_timeout_server: 60m