Skip to content

Commit

Permalink
Add mac_sync
Browse files Browse the repository at this point in the history
  • Loading branch information
ViMesTor committed Jan 26, 2024
1 parent ee00f02 commit ab2f5d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions resources/recipes/prepare_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
5 changes: 4 additions & 1 deletion resources/templates/default/motd.erb
Original file line number Diff line number Diff line change
@@ -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? %>
Expand All @@ -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? %>
Expand Down Expand Up @@ -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') %>
Expand Down

0 comments on commit ab2f5d5

Please sign in to comment.