fix: enable new consul clusters to be started

- wait for the enc_role fact to be correct, as this is required to find
  all keys in hiera
This commit is contained in:
Ben Vincent 2024-04-24 23:51:26 +10:00
parent 89fcfe38ea
commit b6d3fc26de

View File

@ -1,10 +1,16 @@
# profiles::consul::server
class profiles::consul::server (
String $gossip_key,
String $primary_datacenter,
Hash $acl,
Hash $ports,
Hash $addresses,
Variant[
Undef,
String
] $gossip_key = undef,
Variant[
Undef,
String
] $primary_datacenter = undef,
Hash $acl = {},
Hash $ports = {},
Hash $addresses = {},
Boolean $members_lookup = false,
String $members_role = undef,
Array $consul_servers = [],
@ -39,6 +45,8 @@ class profiles::consul::server (
Boolean $disable_update_check = true,
) {
# wait for all attributes to be ready
if $facts['enc_role'] == $members_role {
# set a datacentre/cluster name
$consul_cluster = "${::facts['country']}-${::facts['region']}"
@ -92,6 +100,7 @@ class profiles::consul::server (
},
}
}
}
# consul before dnsmasq
if defined(Class['consul']) {