Project

General

Profile

Provisioning Email Reports » History » Version 3

Leos Stejskal, 10/15/2021 11:49 AM

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 3 Leos Stejskal
Hostname: <%= @host %> (<%= @host.ip %>)
23
Foreman Host-Group: <%= @host.hostgroup %>
24
MAC: <%= @host.mac %>
25
OS: <%= @host.os %> 
26
Puppet Master: <%= @host.puppetmaster %>
27
Puppet Environment: <%= @host.environment %>
28 1 Josh Baird
29
==========================================================
30
31 3 Leos Stejskal
Questions?  Contact EIT UNIX TEAM (eitunixteam@follett.com)" | mail -s "Linux Build Report (<%= @host %> [<%= @host.ip %>])" -r "Foreman (foreman@domain.com)" tunixteam@domain.com
32 2 Josh Baird
</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.