update proxy and tmplate

This commit is contained in:
Arne Teuke
2025-02-08 13:52:46 +01:00
parent 8c1f3ebd86
commit 7f8c595e76
2 changed files with 26 additions and 21 deletions

View File

@@ -42,6 +42,8 @@ define cd_haproxy::server::proxy (
$be_option = '',
$fe_tcp_request = '',
$fe_http_request = '',
$backend_configs = [],
) {
@@ -65,16 +67,28 @@ define cd_haproxy::server::proxy (
# create frontend section
concat::fragment { "frontend_${name}":
target => $hy_main_config,
content => template($hy_frontendrule),
order => $frontend_order,
target => $hy_main_config,
content => template($hy_frontendrule),
order => $frontend_order,
}
# create backend section
concat::fragment { "backend_${name}":
target => $hy_main_config,
content => template($hy_backendrule),
order => $backend_order,
# Create backend sections dynamically based on $backend_configs
$backend_configs.each |$index, $backend_config| {
concat::fragment { "backend_${name}_${index}":
target => $hy_main_config,
content => template($hy_backendrule),
order => $backend_order,
# Use variables from the backend config for each backend
variables => $backend_config,
}
}
# # create backend section
# concat::fragment { "backend_${name}":
# target => $hy_main_config,
# content => template($hy_backendrule),
# order => $backend_order,
# }
}