]> gitweb.fluxo.info Git - puppet-nodo.git/commitdiff
Add nodo::subsystem::mail::msmtp
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 22 Jun 2018 14:22:05 +0000 (11:22 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 22 Jun 2018 14:22:05 +0000 (11:22 -0300)
manifests/subsystem/mail.pp
manifests/subsystem/mail/msmtp.pp [new file with mode: 0644]
manifests/utils/network/mail.pp
templates/msmtp/msmtprc.erb [new file with mode: 0644]

index 23ad86521860e7afb25bc17f2f85273221286338..d0773e93e16bd1274dac6d1b8141f8d81d2161a3 100644 (file)
@@ -2,6 +2,9 @@ class nodo::subsystem::mail {
   # Email delivery configuration
   $mail_delivery = hiera('nodo::subsystem::mail::delivery', 'exim')
 
+  # A handy SMTP wrapper
+  include nodo::subsystem::mail::msmtp
+
   if $mail_delivery != 'postfix' {
   #if !defined(Package['mailx']) {
     package { 'mailx':
diff --git a/manifests/subsystem/mail/msmtp.pp b/manifests/subsystem/mail/msmtp.pp
new file mode 100644 (file)
index 0000000..11e6e3f
--- /dev/null
@@ -0,0 +1,15 @@
+class nodo::subsystem::mail::msmtp {
+  if !defined(Package['msmtp']) {
+    package { 'msmtp':
+      ensure => present,
+    }
+  }
+
+  file { '/etc/msmtprc':
+    ensure  => present,
+    owner   => root,
+    group   => root,
+    mode    => '0644',
+    content => template('nodo/msmtp/msmtprc.erb'),
+  }
+}
index 13c84839ef23a8b1355dfdcf2ec787950a3a637b..ea1d580f7c8f302f86354ea7897749e70178b367 100644 (file)
@@ -10,11 +10,16 @@ class nodo::utils::network::mail (
     'bogofilter',
     'fetchmail',
     'procmail',
-    'msmtp',
   ]:
     ensure => $ensure,
   }
 
+  if !defined(Package['msmtp']) {
+    package { 'msmtp':
+      ensure => present,
+    }
+  }
+
   package { [
     'mutt-patched',
   ]:
diff --git a/templates/msmtp/msmtprc.erb b/templates/msmtp/msmtprc.erb
new file mode 100644 (file)
index 0000000..50fd71a
--- /dev/null
@@ -0,0 +1,5 @@
+account default
+host localhost
+port 25
+auto_from on
+maildomain <%= scope.lookupvar('::fqdn') %>