From 040073e7463a661340aea83da744fe5ebeb40d1f Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Thu, 18 Jul 2013 13:25:27 -0700 Subject: [PATCH] Make gerrit email server configurable Sometimes people need to send mail through a smarthost. Allow that. Change-Id: I66ff43a3ca4fce63500755d16be3aa891d55bc75 --- modules/exim/manifests/init.pp | 1 + modules/exim/templates/exim4.conf.erb | 9 +++++++++ modules/gerrit/manifests/init.pp | 6 ++++++ modules/gerrit/templates/gerrit.config.erb | 3 ++- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/modules/exim/manifests/init.pp b/modules/exim/manifests/init.pp index 478171502f..86bd1890d5 100644 --- a/modules/exim/manifests/init.pp +++ b/modules/exim/manifests/init.pp @@ -3,6 +3,7 @@ class exim( $queue_interval = '30m', $queue_run_max = '5', $queue_smtp_domains = '', + $smarthost = '', $sysadmin = [] ) { diff --git a/modules/exim/templates/exim4.conf.erb b/modules/exim/templates/exim4.conf.erb index 7fb1ff07e4..e3b424c707 100644 --- a/modules/exim/templates/exim4.conf.erb +++ b/modules/exim/templates/exim4.conf.erb @@ -606,12 +606,21 @@ mailman_router: # If the DNS lookup fails, no further routers are tried because of the no_more # setting, and consequently the address is unrouteable. +<% if smarthost -%> +smarthost: + driver = manualroute + domains = !+local_domains + transport = remote_smtp + route_list = * <%= smarthost %> + no_more +<% else -%> dnslookup: driver = dnslookup domains = ! +local_domains transport = remote_smtp ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 no_more +<% end -%> # The remaining routers handle addresses in the local domain(s), that is those # domains that are defined by "domainlist local_domains" above. diff --git a/modules/gerrit/manifests/init.pp b/modules/gerrit/manifests/init.pp index 1d2ed192a1..dbec0c38fa 100644 --- a/modules/gerrit/manifests/init.pp +++ b/modules/gerrit/manifests/init.pp @@ -18,6 +18,10 @@ # The URL to use for OpenID in SSO mode. # email: # The email address Gerrit should use when sending mail. +# smtpserver: +# The smtp server that Gerrit should send mail through. +# sendemail_from: +# gerrit.conf value for sendemail.from. # database_poollimit: # container_heaplimit: # core_packedgitopenfiles: @@ -88,6 +92,8 @@ class gerrit( $ssh_project_rsa_pubkey_contents = '', # If left empty will not create file. $openidssourl = 'https://login.launchpad.net/+openid', $email = '', + $smtpserver = 'localhost', + $sendemail_from = 'MIXED', $database_poollimit = '', $container_heaplimit = '', $core_packedgitopenfiles = '', diff --git a/modules/gerrit/templates/gerrit.config.erb b/modules/gerrit/templates/gerrit.config.erb index ea1b59788a..c72a4fb946 100644 --- a/modules/gerrit/templates/gerrit.config.erb +++ b/modules/gerrit/templates/gerrit.config.erb @@ -19,7 +19,8 @@ cookieSecure = true contributorAgreements = true [sendemail] - smtpServer = localhost + smtpServer = <%= smtpserver %> + from = <%= sendemail_from %> [container] user = gerrit2 javaHome = <%= java_home %>