Project

General

Profile

Provisioning Email Reports » History » Version 2

Josh Baird, 06/04/2012 03:56 PM

1 1 Josh Baird
h1. Provisioning Email Reports
2
3
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.  
4
5
1.  Browse to More -> Provisioning Templates
6
2.  Click "New Template"
7
3.  Name the report 
8
4.  Choose "Finish" for the "Template kind"
9
5.  Paste the following in the box:
10
11 2 Josh Baird
<pre>
12
#!/bin/sh
13 1 Josh Baird
# Generate an email report once the host is provisioned
14
15
echo "
16
Foreman build report.
17
==========================================================
18
http://foreman.domain.com/
19
20
The system has been provisioned and is now ready for use.  Additional Puppet modules may be assigned from Foreman.
21
22
Hostname: <%25= @host %25> (<%25= @host.ip %25>)
23
Foreman Host-Group: <%25= @host.hostgroup %25>
24
MAC: <%25= @host.mac %25>
25
OS: <%25= @host.os %25> 
26
Puppet Master: <%25= @host.puppetmaster %25>
27
Puppet Environment: <%25= @host.environment %25>
28
29
==========================================================
30
31 2 Josh Baird
Questions?  Contact EIT UNIX TEAM (eitunixteam@follett.com)" | mail -s "Linux Build Report (<%25= @host %25> [<%25= @host.ip %25>])" -r "Foreman (foreman@domain.com)" tunixteam@domain.com
32
</pre>
33 1 Josh Baird
34
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.