feat: enabling changing ip for consul client
All checks were successful
Build / precommit (pull_request) Successful in 5m14s

- enable ability to set consul client bind/advertise ip
This commit is contained in:
Ben Vincent 2025-08-14 20:00:14 +10:00
parent 62aade77ff
commit 463b0d35d4
2 changed files with 4 additions and 2 deletions

View File

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

View File

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