Haproxy endpoint resource: set defaults for server_names and IPs

It's not trivial to set the server names and IP addresses for dynamic
haproxy endpoints due to the fact that hiera renders the array as a
string. In order to make this work, we try to be clever and get the
server names and IPs from hiera directly as a default value. This should
work as long as the endpoint uses the same name as the service.

Closes-Bug: #1743626
Change-Id: I51eebfeceb5915fb0add8332c50386f6df93dca5
This commit is contained in:
Juan Antonio Osorio Robles 2018-01-05 16:06:09 +02:00
parent 149a15ef84
commit 5a51ec58b4
1 changed files with 10 additions and 8 deletions

View File

@ -24,16 +24,18 @@
# [*service_port*]
# The default port on which the endpoint will be listening.
#
# [*ip_addresses*]
# The ordered list of IPs to be used to contact the balancer member.
#
# [*server_names*]
# The names of the balancer members, which usually should be the hostname.
#
# [*member_options*]
# Options for the balancer member, specified after the server declaration.
# These should go in the member's configuration block.
#
# [*ip_addresses*]
# The ordered list of IPs to be used to contact the balancer member.
# Defaults to hiera("${name}_node_ips", undef)
#
# [*server_names*]
# The names of the balancer members, which usually should be the hostname.
# Defaults to hiera("${name}_node_names", undef)
#
# [*public_virtual_ip*]
# Address in which the proxy endpoint will be listening in the public network.
# If this service is internal only this should be ommitted.
@ -99,9 +101,9 @@
define tripleo::haproxy::endpoint (
$internal_ip,
$service_port,
$ip_addresses,
$server_names,
$member_options,
$ip_addresses = hiera("${name}_node_ips", undef),
$server_names = hiera("${name}_node_names", undef),
$public_virtual_ip = undef,
$mode = undef,
$haproxy_listen_bind_param = undef,