#!/bin/bash
# -*- mode: shell-script -*-
#
# 01-bach-variables
# 
# Print relevant BACH variables and hardware info on login.
#

<% mfg = node['dmi']['system']['manufacturer']
   product = node['dmi']['system']['product_name']
   gb = (node['memory']['total'].to_f / 1024 / 1024).round
   cores = node[:cpu]['0'][:cores].to_i * node[:cpu][:real] %>

cat << EOF

You have logged into a member of a BACH cluster.

<% if node[:virtualization][:role] == 'guest' %>
This is a virtual machine with <%= gb %> GB of RAM and <%= cores %> CPU cores.
<% else %>
This system is a <%= mfg %> <%= product %>.
It is equipped with <%= gb %> GB of RAM and <%= cores %> CPU cores.
<% end %>

Environment: <%= node.chef_environment %>
Zabbix URL: https://<%= node[:bcpc][:management][:vip] %>:<%= node[:bcpc][:zabbix][:web_port] %>
Graphite URL: https://<%= node[:bcpc][:management][:vip] %>:<%= node[:bcpc][:graphite][:web_port] %>
Bootstrap node IP: <%= node[:bcpc][:bootstrap][:server] %>
Roles:
<% node.run_list.each do |entry| %>
<%= "  - #{entry.to_s}" %>
<% end %>

EOF


#!/bin/bash
# -*- mode: shell-script -*-
#
# 01-bach-variables
#
# Print relevant BACH variables and hardware info on login.
#

<%
 mfg = node['dmi']['system']['manufacturer']
 product = node['dmi']['system']['product_name']
 gb = (node['memory']['total'].to_f / 1024 / 1024).round
 cores = node[:cpu]['0'][:cores].to_i * node[:cpu][:real]

 chef_bach_version =
   node.run_context.cookbook_collection['bach_common'].version rescue nil
%>

cat << EOF

You have logged into a member of a BACH cluster.

<% if node[:virtualization][:role] == 'guest' %>
This is a virtual machine with <%= gb %> GB of RAM and <%= cores %> CPU cores.
<% else %>
This system is a <%= mfg %> <%= product %>.
It is equipped with <%= gb %> GB of RAM and <%= cores %> CPU cores.
<% end %>

Chef-bach version: <%= chef_bach_version || 'UNKNOWN' %>
Environment: <%= node.chef_environment %>
Zabbix URL: https://<%= node[:bcpc][:management][:vip] %>:<%= node[:bcpc][:zabbix][:web_port] %>
Graphite URL: https://<%= node[:bcpc][:management][:vip] %>:<%= node[:bcpc][:graphite][:web_port] %>
Bootstrap node IP: <%= node[:bcpc][:bootstrap][:server] %>
Roles:
<% node.run_list.each do |entry| %>
<%= "  - #{entry.to_s}" %>
<% end %>

EOF

Add chef-bach version to the MotD
Add chef-bach version to the MotD
