puppet-prod/site/profiles/manifests/haproxy/backends.pp
Ben Vincent 82f2d75888 feat: add frontends, backends, listeners
- add a way to define frontends, backends and listeners through hieradata
2024-04-06 20:23:37 +11:00

20 lines
531 B
Puppet

# profiles::haproxy::backends
class profiles::haproxy::backends {
# set location_environment
$location_environment = "${facts['country']}-${facts['region']}-${facts['environment']}"
# for each backend:
$backends = lookup('profiles::haproxy::backends', Hash, 'deep', {})
$backends.each |$backend, $data| {
# create backend
haproxy::backend { $backend:
* => $data,
}
# collect exported resources
$tag = "${backend}_${location_environment}"
Haproxy::Balancermember <<| tag == $tag |>>
}
}