]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/commitdiff
Add mail profile
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Sat, 17 Mar 2018 10:00:48 +0000 (11:00 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Mon, 19 Mar 2018 15:19:17 +0000 (16:19 +0100)
environments/global/common.yaml
modules/profile/manifests/mail.pp [new file with mode: 0644]
modules/profile/templates/mail/ssmtp.conf.erb [new file with mode: 0644]

index 591119498fb088bac7d53fb60b45a429d6415d67..e7c70d4657eb77e5481634c94255ed46b770b230 100644 (file)
@@ -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 (file)
index 0000000..cc47b77
--- /dev/null
@@ -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 (file)
index 0000000..e7a0410
--- /dev/null
@@ -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 %>