From c8288e2368ad7280baa96226fa0009db95aa7d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Negr=C3=B3n?= <45871721+manegron@users.noreply.github.com> Date: Fri, 1 Dec 2023 16:45:52 +0000 Subject: [PATCH] Bugfix/fix sync ip (#91) * pass sync ip to chef-server and kafka --- resources/recipes/configure.rb | 4 +++- resources/recipes/prepare_system.rb | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/resources/recipes/configure.rb b/resources/recipes/configure.rb index fe50f26b..32ca6a21 100644 --- a/resources/recipes/configure.rb +++ b/resources/recipes/configure.rb @@ -25,7 +25,7 @@ consul_config "Configure Consul Server" do confdir node["consul"]["confdir"] datadir node["consul"]["datadir"] - ipaddress node["ipaddress"] + ipaddress node["ipaddress_sync"] cdomain node["redborder"]["cdomain"] dns_local_ip node["consul"]["dns_local_ip"] (manager_services["consul"] ? (is_server true) : (is_server false)) @@ -38,6 +38,7 @@ postgresql false postgresql_memory node["redborder"]["memory_services"]["postgresql"]["memory"] chef_active manager_services["chef-server"] + ipaddress node["ipaddress_sync"] action [:add, :register] end else @@ -59,6 +60,7 @@ managers_list node["redborder"]["managers_per_services"]["kafka"] zk_hosts node["redborder"]["zookeeper"]["zk_hosts"] host_index node["redborder"]["kafka"]["host_index"] + ipaddress node["ipaddress_sync"] action (manager_services["kafka"] ? [:add, :register] : [:remove, :deregister]) end diff --git a/resources/recipes/prepare_system.rb b/resources/recipes/prepare_system.rb index aad85830..7b0b051a 100644 --- a/resources/recipes/prepare_system.rb +++ b/resources/recipes/prepare_system.rb @@ -22,6 +22,14 @@ node.default["redborder"]["services"]["consul-client"] = true end +#Set :ipaddress_sync +ipaddress_sync=node["ipaddress"] +node['network']['interfaces'].each do |interface, details| + next unless "x#{interface}" != "xlo" + ipaddress_sync = details['addresses'].keys[1] if (details['addresses'] and ipaddress_sync != details['addresses'].keys[1]) +end +node.default[:ipaddress_sync]=ipaddress_sync + #Configure and enable chef-client dnf_package "redborder-chef-client" do flush_cache [:before]