From ab2f5d509c2f1e1b9a8f603c1260dd4f7b650e29 Mon Sep 17 00:00:00 2001 From: vimesa Date: Fri, 26 Jan 2024 14:17:19 +0000 Subject: [PATCH] Add mac_sync --- resources/recipes/prepare_system.rb | 4 ++++ resources/templates/default/motd.erb | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/recipes/prepare_system.rb b/resources/recipes/prepare_system.rb index 7b0b051a..e3b0cbb8 100644 --- a/resources/recipes/prepare_system.rb +++ b/resources/recipes/prepare_system.rb @@ -30,6 +30,10 @@ end node.default[:ipaddress_sync]=ipaddress_sync +#get mac +mac_sync = `ip a | grep -w -B2 #{ipaddress_sync} | awk '{print toupper($2)}' | head -n 1 | tr -d '\n'` +node.default["mac_sync"] = mac_sync + #Configure and enable chef-client dnf_package "redborder-chef-client" do flush_cache [:before] diff --git a/resources/templates/default/motd.erb b/resources/templates/default/motd.erb index b87d5877..8889ba88 100644 --- a/resources/templates/default/motd.erb +++ b/resources/templates/default/motd.erb @@ -1,7 +1,9 @@ + <% if !node["redborder"]["manager"]["cluster_name"].nil? %> Welcome to '<%= node["redborder"]["manager"]["cluster_name"] %>' redborder cluster: <% else %> Welcome to <%= node["hostname"] %>.<%= node["redborder"]["cdomain"] %> (<%= node['platform'] %> - <%= node['platform_version'] %>): + Kernel <%= node['os'] %> - <%= node['os_version'] %> <% end %> <% if !node["redborder"].nil? and !node["redborder"]["rpms"].nil? %> @@ -16,6 +18,7 @@ manager_index = manager_list.index(node.name) ipaddress_sync = node["ipaddress_sync"] + %> Cluster: <%= (( @cluster_info.size == 1 ) ? "1 member" : "#{@cluster_info.size} members") unless @cluster_info.nil? %> @@ -58,7 +61,7 @@ <% end %> Host: <%= node['ipaddress'] %> (<%= node['macaddress'].nil? ? "" : node['macaddress'] %>) <% if node['ipaddress'] != ipaddress_sync %> - IP sync : <%= ipaddress_sync %> (<%= node['macaddress'].nil? ? "" : node['macaddress'] %>) + IP sync : <%= ipaddress_sync %> (<%= node['mac_sync'].nil? ? "" : node['mac_sync'] %>) <%end %> Installed on: <% inst = `rpm -q basesystem --qf '%{installtime:date}\n'` ; inst = inst.gsub("\n","") %><%= inst %> Last check: <%= Time.at(node[:ohai_time]).strftime('%a %b %d %H:%M:%S %Z %Y') %>