Use Case
When running HAProxy in an HA cluster, stick tables need to be shared between peers. Since HAProxy 2.4, stick tables can be declared directly inside the peers block:
peers mycluster
peer loadbalancer1 192.168.1.10:10000
peer loadbalancer2 192.168.1.11:10000
table sticktable1 type ip size 1m expire 10s store http_req_rate(10s)
Currently, haproxy::peers and its template haproxy_peers_block.epp only render the peers <name> header and the peer entries. There is no way to declare table entries inside the block through the module.
Describe the Solution You Would Like
Add an optional $tables parameter to haproxy::peers, accepting a list of hashes, and update haproxy_peers_block.epp to render the corresponding table lines.
Example usage:
haproxy::peers { 'mycluster':
tables => [
{
name => 'sticktable1',
type => 'ip',
size => '1m',
expire => '10s',
store => 'http_req_rate(10s)',
},
],
}
Expected output:
peers mycluster
peer loadbalancer1 192.168.1.10:10000
peer loadbalancer2 192.168.1.11:10000
table sticktable1 type ip size 1m expire 10s store http_req_rate(10s)
Describe Alternatives You've Considered
The classic syntax — referencing the peers section from within a backend's stick-table directive — still works and is already supported by the module:
backend my_table
stick-table type ip size 1m expire 10s store http_req_rate(10s) peers mycluster
However, this requires managing the stick table in the backend rather than centralising it in the peers block, which is the approach recommended in HAProxy 2.4+ documentation.
Additional Context
Use Case
When running HAProxy in an HA cluster, stick tables need to be shared between peers. Since HAProxy 2.4, stick tables can be declared directly inside the
peersblock:Currently,
haproxy::peersand its templatehaproxy_peers_block.epponly render thepeers <name>header and thepeerentries. There is no way to declaretableentries inside the block through the module.Describe the Solution You Would Like
Add an optional
$tablesparameter tohaproxy::peers, accepting a list of hashes, and updatehaproxy_peers_block.eppto render the correspondingtablelines.Example usage:
Expected output:
Describe Alternatives You've Considered
The classic syntax — referencing the peers section from within a backend's
stick-tabledirective — still works and is already supported by the module:However, this requires managing the stick table in the backend rather than centralising it in the peers block, which is the approach recommended in HAProxy 2.4+ documentation.
Additional Context
manifests/peers.pp,templates/haproxy_peers_block.epp