Provisioning Email Reports

Some may find it useful to have a host email you a small report once it has been provisioned. Cobbler does this out of the box. This is how I made it work using Foreman.

1. Browse to More -> Provisioning Templates
2. Click "New Template"
3. Name the report
4. Choose "Finish" for the "Template kind"
5. Paste the following in the box:

#!/bin/sh
# Generate an email report once the host is provisioned

echo " 
Foreman build report.
==========================================================
http://foreman.domain.com/

The system has been provisioned and is now ready for use.  Additional Puppet modules may be assigned from Foreman.

Hostname: <%= @host %> (<%= @host.ip %>)
Foreman Host-Group: <%= @host.hostgroup %>
MAC: <%= @host.mac %>
OS: <%= @host.os %> 
Puppet Master: <%= @host.puppetmaster %>
Puppet Environment: <%= @host.environment %>

==========================================================

Questions?  Contact EIT UNIX TEAM (eitunixteam@follett.com)" | mail -s "Linux Build Report (<%= @host %> [<%= @host.ip %>])" -r "Foreman (foreman@domain.com)" tunixteam@domain.com

You can use other variables that Foreman makes available to you as well. This email will be generated FROM the host that you are provisioning, not from the Foreman host.