feat: add haproxy2 role (#322)
- add basic haproxy2 role - add peers and resolvers - add haproxy2+ metrics frontend Reviewed-on: https://git.query.consul/unkinben/puppet-prod/pulls/322
This commit was merged in pull request #322.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
# profiles::haproxy::dns
|
||||
class profiles::haproxy::dns (
|
||||
Stdlib::IP::Address $vrrp_ipaddr,
|
||||
Boolean $vrrp_master = false,
|
||||
Stdlib::IP::Address $ipaddr,
|
||||
Array[Stdlib::Fqdn] $vrrp_cnames = [],
|
||||
Array[Stdlib::Fqdn] $cnames = [],
|
||||
Integer $order = 10,
|
||||
@@ -28,24 +27,37 @@ class profiles::haproxy::dns (
|
||||
}
|
||||
}
|
||||
|
||||
# export a/cnames for haproxy applications
|
||||
if $vrrp_master {
|
||||
profiles::dns::record { "${facts['networking']['fqdn']}_vrrp_${location_environment}-halb-vrrp":
|
||||
value => $vrrp_ipaddr,
|
||||
type => 'A',
|
||||
record => "${location_environment}-halb-vrrp",
|
||||
zone => $::facts['networking']['domain'],
|
||||
order => $order,
|
||||
}
|
||||
# if it is, find hosts, sort them so they dont cause changes every run
|
||||
$servers_array = sort(query_nodes(
|
||||
"enc_role='${facts['enc_role']}' and
|
||||
country='${facts['country']}' and
|
||||
region='${facts['region']}' and
|
||||
environment='${facts['environment']}'",
|
||||
'networking.fqdn'
|
||||
))
|
||||
|
||||
$vrrp_cnames.each |$cname| {
|
||||
profiles::dns::record { "${::facts['networking']['fqdn']}_${cname}_CNAME":
|
||||
value => "${location_environment}-halb-vrrp",
|
||||
type => 'CNAME',
|
||||
record => "${cname}.",
|
||||
# give enough time for a few hosts to be provisioned
|
||||
if length($servers_array) >= 3 {
|
||||
|
||||
# if this is the first host in the returned filter, export a/cnames for haproxy applications
|
||||
if $servers_array[0] == $trusted['certname'] {
|
||||
profiles::dns::record { "${facts['networking']['fqdn']}_vrrp_${location_environment}-halb-vrrp":
|
||||
value => $ipaddr,
|
||||
type => 'A',
|
||||
record => "${location_environment}-halb-vrrp",
|
||||
zone => $::facts['networking']['domain'],
|
||||
order => $order,
|
||||
}
|
||||
|
||||
$vrrp_cnames.each |$cname| {
|
||||
profiles::dns::record { "${::facts['networking']['fqdn']}_${cname}_CNAME":
|
||||
value => "${location_environment}-halb-vrrp",
|
||||
type => 'CNAME',
|
||||
record => "${cname}.",
|
||||
zone => $::facts['networking']['domain'],
|
||||
order => $order,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user