Skip to content

Commit

Permalink
Add motd
Browse files Browse the repository at this point in the history
  • Loading branch information
ViMesTor committed Jan 30, 2024
1 parent b3074d8 commit a29e40b
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
14 changes: 14 additions & 0 deletions resources/recipes/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,20 @@
action :add
end


#--------------------------MOTD--------------------------#

manager =`grep "cloud_address" /etc/redborder/rb_init_conf.yml | cut -d' ' -f2`

template "/etc/motd" do
source "motd.erb"
owner "root"
group "root"
mode 0644
retries 2
variables(:manager_info => node["redborder"]["cdomain"], :manager => manager)
end

## TODO: replace node["redborder"]["services"] in action with "proxy_services"..
#freeradius_config "Configure radiusd" do
# flow_nodes node["redborder"]["sensors_info_all"]["flow-sensor"]
Expand Down
37 changes: 37 additions & 0 deletions resources/templates/default/motd.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

<% if File.exist?"/etc/firstboot.flag" %>
Welcome to redborder-ng Proxy to Cloud (<%= node["hostname"] %>):
Kernel: <%= node['os_version'].gsub("el9", "") %>

UUID: <%= `cat /etc/rb-uuid`.chomp %>
Version: <%= `rpm -qa | grep redborder-proxy- | sed 's/redborder-proxy-//' | sed 's/\.x86_64//' | sed 's/\.el[0-9]\+.rb.noarch//'`.chomp %>
CPUs: <%= node["cpu"]["total"] unless node["cpu"].nil? %>
Memory: <%= "%.2f GB" % [ node["memory"]["total"].to_f/(1000*1000) ] unless node["memory"].nil? %>
IP address: <%= node['ipaddress'] %>
MAC: <%= node['macaddress'].nil? ? "" : node['macaddress'] %>
<% else %>
Welcome to redborder-ng Proxy [<%= node["hostname"] %>] (<%= node['platform'] %> - <%= node['platform_version'] %>):
Kernel: <%= node['os_version'].gsub("el9", "") %>

<% if !node["redborder"].nil? and !node["redborder"]["rpms"].nil? %>
<% node["redborder"]["rpms"].each do |k, v| %>
* <%= "redborder-%-12s" % [ k ] %> => <%= v %>
<% end %>
<% end %>

Manager IP: <%= @manager.chomp %>
Domain: <%= @manager_info %>
CPUs: <%= node["cpu"]["total"] unless node["cpu"].nil? %>
Memory: <%= "%.2f GB" % [ node["memory"]["total"].to_f/(1000*1000) ] unless node["memory"].nil? %>
Host: <%= node['ipaddress'] %> (<%= node['macaddress'].nil? ? "" : node['macaddress'] %>)
Last check: <%= Time.at(node[:ohai_time]).strftime('%a %b %e %H:%M:%S %Z %Y') %>
UUID: <%= `cat /etc/rb-uuid`.chomp %>
<% end %>

Collector Addresses:
* Netflow <%= node['ipaddress'] %>:2055
* sFlow <%= node['ipaddress'] %>:6343
* MSE 10 <%= node['ipaddress'] %>:2056
* MSE 8 <%= node['ipaddress'] %>:2057
* AAA Records <%= node['ipaddress'] %>:1813
* Vault <%= node['ipaddress'] %>:514

0 comments on commit a29e40b

Please sign in to comment.