feat: add cnames to haproxy
- manage A records for haproxy - manage cnames for services using haproxy
This commit is contained in:
@@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user