From 82caf31189f11a9bca4836260e8ee8ba954690f2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Sat, 17 Mar 2018 11:00:48 +0100 Subject: [PATCH] Add mail profile --- environments/global/common.yaml | 1 + modules/profile/manifests/mail.pp | 14 ++++++++++++++ modules/profile/templates/mail/ssmtp.conf.erb | 14 ++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 modules/profile/manifests/mail.pp create mode 100644 modules/profile/templates/mail/ssmtp.conf.erb diff --git a/environments/global/common.yaml b/environments/global/common.yaml index 5911194..e7c70d4 100644 --- a/environments/global/common.yaml +++ b/environments/global/common.yaml @@ -30,5 +30,6 @@ base_installation::system_timezone: "Europe/Paris" base_installation::system_users: [] # Fetched via ldap profile::xmr_stak::mining_pool: "" # Fetched via ldap profile::xmr_stak::wallet: "" # Fetched via ldap +profile::mail::mailhub: "" # Fetched via ldap letsencrypt::email: ~ # Fetched via ldap letsencrypt::try_for_real_hostname: true diff --git a/modules/profile/manifests/mail.pp b/modules/profile/manifests/mail.pp new file mode 100644 index 0000000..cc47b77 --- /dev/null +++ b/modules/profile/manifests/mail.pp @@ -0,0 +1,14 @@ +class profile::mail ( + String $mailhub, + Optional[Integer] $mailhub_port = 25, +) { + ensure_packages(["s-nail", "ssmtp"]) + + $hostname = lookup("base_installation::real_hostname") + + file { "/etc/ssmtp/ssmtp.conf": + ensure => "present", + content => template("profile/mail/ssmtp.conf.erb"), + } +} + diff --git a/modules/profile/templates/mail/ssmtp.conf.erb b/modules/profile/templates/mail/ssmtp.conf.erb new file mode 100644 index 0000000..e7a0410 --- /dev/null +++ b/modules/profile/templates/mail/ssmtp.conf.erb @@ -0,0 +1,14 @@ +# +# /etc/ssmtp.conf -- a config file for sSMTP sendmail. +# +# The person who gets all mail for userids < 1000 +# Make this empty to disable rewriting. +root=postmaster +# The place where the mail goes. The actual machine name is required +# no MX records are consulted. Commonly mailhosts are named mail.domain.com +# The example will fit if you are in domain.com and you mailhub is so named. +mailhub=<%= @mailhub %>:<%= @mailhub_port %> +# Where will the mail seem to come from? +#rewriteDomain=y +# The full hostname +hostname=<%= @hostname %> -- 2.41.0