feat: enabling changing ip for consul client (#383)

- enable ability to set consul client bind/advertise ip

Reviewed-on: #383
This commit is contained in:
Ben Vincent 2025-08-14 22:55:35 +10:00
parent 62aade77ff
commit 8f5d102945
2 changed files with 4 additions and 2 deletions

View File

@ -37,6 +37,7 @@ profiles::ssh::sign::principals:
- "%{facts.networking.interfaces.enp3s0.ip}"
# configure consul service
profiles::consul::client::host_addr: "%{hiera('networking_loopback0_ip')}"
consul::services:
incus:
service_name: 'incus'

View File

@ -11,6 +11,7 @@ class profiles::consul::client (
Stdlib::Absolutepath $data_dir = '/opt/consul',
Array[Hash] $node_rules = [],
Hash $ports = {},
Stdlib::IP::Address $host_addr = $facts['networking']['ip'],
) {
if $facts['enc_role'] != $members_role {
@ -42,8 +43,8 @@ class profiles::consul::client (
'log_level' => 'INFO',
'node_name' => $facts['networking']['fqdn'],
'retry_join' => $servers_array,
'bind_addr' => $::facts['networking']['ip'],
'advertise_addr' => $::facts['networking']['ip'],
'bind_addr' => $host_addr,
'advertise_addr' => $host_addr,
'enable_script_checks' => true,
'ports' => $ports,
'acl' => {