feat: add cnames to haproxy
- manage A records for haproxy - manage cnames for services using haproxy
This commit is contained in:
parent
e97d061f46
commit
c9a1d35af9
@ -82,3 +82,8 @@ profiles::haproxy::certlist::certificates:
|
|||||||
profiles::pki::vault::alt_names:
|
profiles::pki::vault::alt_names:
|
||||||
- puppetboard.main.unkin.net
|
- puppetboard.main.unkin.net
|
||||||
- puppetdbapi.main.unkin.net
|
- puppetdbapi.main.unkin.net
|
||||||
|
|
||||||
|
# additional cnames
|
||||||
|
profiles::haproxy::dns::cnames:
|
||||||
|
- puppetboard.main.unkin.net
|
||||||
|
- puppetdbapi.main.unkin.net
|
||||||
|
|||||||
27
site/profiles/manifests/haproxy/dns.pp
Normal file
27
site/profiles/manifests/haproxy/dns.pp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# profiles::haproxy::dns
|
||||||
|
class profiles::haproxy::dns (
|
||||||
|
Array[Stdlib::Fqdn] $cnames = [],
|
||||||
|
Integer $order = 10,
|
||||||
|
){
|
||||||
|
|
||||||
|
# create an A record for each load balancer in a region
|
||||||
|
$location_environment = "${facts['country']}-${facts['region']}-${facts['environment']}"
|
||||||
|
profiles::dns::record { "${facts['networking']['fqdn']}_${location_environment}-halb_A":
|
||||||
|
value => $::facts['networking']['ip'],
|
||||||
|
type => 'A',
|
||||||
|
record => "${location_environment}-halb",
|
||||||
|
zone => $::facts['networking']['domain'],
|
||||||
|
order => $order,
|
||||||
|
}
|
||||||
|
|
||||||
|
# export cnames for haproxy applications
|
||||||
|
$cnames.each |$cname| {
|
||||||
|
profiles::dns::record { "${::facts['networking']['fqdn']}_${cname}_CNAME":
|
||||||
|
value => "${location_environment}-halb",
|
||||||
|
type => 'CNAME',
|
||||||
|
record => "${cname}.",
|
||||||
|
zone => $::facts['networking']['domain'],
|
||||||
|
order => $order,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@
|
|||||||
class profiles::haproxy::server (
|
class profiles::haproxy::server (
|
||||||
Hash $globals = {},
|
Hash $globals = {},
|
||||||
Hash $defaults = {},
|
Hash $defaults = {},
|
||||||
|
Array $cnames = [],
|
||||||
){
|
){
|
||||||
|
|
||||||
# default global/defaults arrays
|
# default global/defaults arrays
|
||||||
@ -50,6 +51,7 @@ class profiles::haproxy::server (
|
|||||||
include profiles::haproxy::ls_stats # default status listener
|
include profiles::haproxy::ls_stats # default status listener
|
||||||
include profiles::haproxy::fe_http # default http frontend
|
include profiles::haproxy::fe_http # default http frontend
|
||||||
include profiles::haproxy::fe_https # default https frontend
|
include profiles::haproxy::fe_https # default https frontend
|
||||||
|
include profiles::haproxy::dns # manage dns for haproxy
|
||||||
|
|
||||||
# for each backend:
|
# for each backend:
|
||||||
$backends = lookup('profiles::haproxy::backends')
|
$backends = lookup('profiles::haproxy::backends')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user