adding option to send extra message on deployment
This commit is contained in:
parent
967eec34c5
commit
c0494dc8f3
11
notify.pl
11
notify.pl
@ -31,6 +31,7 @@ use POSIX qw(strftime);
|
|||||||
# get function and function_variable (vmid) from arguments
|
# get function and function_variable (vmid) from arguments
|
||||||
my $function = $ARGV[0] || "empty";
|
my $function = $ARGV[0] || "empty";
|
||||||
my $function_variable = $ARGV[1] || "empty";
|
my $function_variable = $ARGV[1] || "empty";
|
||||||
|
my $message = $ARGV[2] || "empty";
|
||||||
|
|
||||||
# define the prices for the different components of the VM
|
# define the prices for the different components of the VM
|
||||||
my $base_price = '64';
|
my $base_price = '64';
|
||||||
@ -144,8 +145,16 @@ sub mailout {
|
|||||||
open(my $fh, '<', $template);
|
open(my $fh, '<', $template);
|
||||||
open my $fh_email, "|-", "/usr/sbin/sendmail -t";
|
open my $fh_email, "|-", "/usr/sbin/sendmail -t";
|
||||||
printf $fh_email "To: %s\n", $_email;
|
printf $fh_email "To: %s\n", $_email;
|
||||||
while (my $row = <$fh>) {
|
TEMPLATE: while (my $row = <$fh>) {
|
||||||
chomp $row;
|
chomp $row;
|
||||||
|
if ($row =~ m/MESSAGE/) {
|
||||||
|
if ($message ne "empty") {
|
||||||
|
$row =~ s/MESSAGE/$message\n/g;
|
||||||
|
} else {
|
||||||
|
next TEMPLATE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$row =~ s/FIRSTNAME/$_firstname/g;
|
$row =~ s/FIRSTNAME/$_firstname/g;
|
||||||
$row =~ s/VMID/$_instance/g;
|
$row =~ s/VMID/$_instance/g;
|
||||||
$row =~ s/SERVER/$conf{'conf'}{'SERVER'}/g;
|
$row =~ s/SERVER/$conf{'conf'}{'SERVER'}/g;
|
||||||
|
@ -7,16 +7,17 @@ Hi FIRSTNAME,
|
|||||||
|
|
||||||
Welcome to OpenBSD Amsterdam! Your VM has been deployed.
|
Welcome to OpenBSD Amsterdam! Your VM has been deployed.
|
||||||
|
|
||||||
|
MESSAGE
|
||||||
You are on host: SERVER.DOMAIN
|
You are on host: SERVER.DOMAIN
|
||||||
Your VM name: VMID
|
Your VM name: VMID
|
||||||
|
|
||||||
Your IPv4 address: IPV4
|
IPv4 address: IPV4
|
||||||
Your IPv4 subnet: IPV4NETMASK
|
IPv4 subnet: IPV4NETMASK
|
||||||
Your IPv4 gateway: IPV4GW
|
IPv4 gateway: IPV4GW
|
||||||
|
|
||||||
Your IPv6 address: IPV6
|
IPv6 address: IPV6
|
||||||
Your IPv6 subnet: 64
|
IPv6 subnet: 64
|
||||||
Your IPv6 gateway: IPV6GW
|
IPv6 gateway: IPV6GW
|
||||||
|
|
||||||
You should be able to ssh into your VM.
|
You should be able to ssh into your VM.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user