I found this: https://github.com/aussielunix/puppet-motd, which uses a puppet template to collect a number of facts along with a really big ASCII banner, that I quite like.
_
_ __ _ _ _ __ _ __ ___| |_
| '_ \| | | | '_ \| '_ \ / _ \ __|
| |_) | |_| | |_) | |_) | __/ |_
| .__/ \__,_| .__/| .__/ \___|\__|
|_| |_| |_|
_ _
_ __ ___ __ _ _ __ __ _ __ _ ___ __| | | |
| '_ ` _ \ / _` | '_ \ / _` |/ _` |/ _ \/ _` | | |
| | | | | | (_| | | | | (_| | (_| | __/ (_| | |_|
|_| |_| |_|\__,_|_| |_|\__,_|\__, |\___|\__,_| (_)
|___/
Any files that have a 'Puppet' header need to be changed in puppet.
Interesting tidbit
In my motd.erb template, I included:
Uptime: <%= uptime %>What happens with this, is that the "uptime" fact (and the other facts included in the template) gets evaluated on the client on every puppet run and a flat file without the puppet mock-up is laid down on the file system. This file gets compared and reevaluated on every run. Here's the point: every day the uptime changes and a new file is laid down in /etc/motd and the old file is backed up. This is clearly pretty inefficient, and needs to be replaced with a function that will process/update the uptime on login, and not on every puppet run.
Resources
https://github.com/aussielunix/puppet-motd
motd.erb
Welcome!
Host: <%= hostname %> (<%= ipaddress %>)
OS: <%= operatingsystem %>, <%= operatingsystemrelease %>, <%= architecture %>, <%= kernelrelease %>
<% if has_variable?("processor0") then -%>
Processor: <%= processorcount %>x <%= processor0 %>
<% end -%>
Hardware: <%= productname %>, <%= virtual %>, RAM: <%= memorysize %>
Uptime: <%= uptime %>
_
_ __ _ _ _ __ _ __ ___| |_
| '_ \| | | | '_ \| '_ \ / _ \ __|
| |_) | |_| | |_) | |_) | __/ |_
| .__/ \__,_| .__/| .__/ \___|\__|
|_| |_| |_|
_ _
_ __ ___ __ _ _ __ __ _ __ _ ___ __| | | |
| '_ ` _ \ / _` | '_ \ / _` |/ _` |/ _ \/ _` | | |
| | | | | | (_| | | | | (_| | (_| | __/ (_| | |_|
|_| |_| |_|\__,_|_| |_|\__,_|\__, |\___|\__,_| (_)
|___/
Any files that have a 'Puppet' header need to be changed in puppet.
init.pp
class motd {
file {'/etc/motd':
ensure => present,
mode => 444,
content => template("motd.erb"),
}
}
No comments:
Post a Comment