feat: add frontends, backends, listeners

- add a way to define frontends, backends and listeners through hieradata
This commit is contained in:
2024-04-06 18:53:53 +11:00
parent cdbb689c91
commit 82f2d75888
6 changed files with 84 additions and 24 deletions
+3 -15
View File
@@ -2,7 +2,6 @@
class profiles::haproxy::server (
Hash $globals = {},
Hash $defaults = {},
Array $cnames = [],
){
# default global/defaults arrays
@@ -52,19 +51,8 @@ class profiles::haproxy::server (
include profiles::haproxy::fe_http # default http frontend
include profiles::haproxy::fe_https # default https frontend
include profiles::haproxy::dns # manage dns for haproxy
include profiles::haproxy::frontends # create frontends
include profiles::haproxy::backends # create backends
include profiles::haproxy::listeners # create listeners
# for each backend:
$backends = lookup('profiles::haproxy::backends')
$backends.each |$backend, $data| {
# create backend
haproxy::backend { $backend:
* => $data,
}
# collect exported resources
$location_environment = "${facts['country']}-${facts['region']}-${facts['environment']}"
$tag = "${backend}_${location_environment}"
Haproxy::Balancermember <<| tag == $tag |>>
}
}