]> xn--ix-yja.es Git - alex.git/commitdiff
Add module to configure root mail
authoralex <alex@pdp7.net>
Sat, 28 Jan 2023 16:34:20 +0000 (17:34 +0100)
committeralex <alex@pdp7.net>
Sat, 28 Jan 2023 16:36:10 +0000 (17:36 +0100)
.gitmodules [new file with mode: 0644]
personal_infra/puppet/modules/mailalias_core [new submodule]
personal_infra/puppet/modules/root_mail/manifests/init.pp [new file with mode: 0644]

diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..9706b66
--- /dev/null
@@ -0,0 +1,3 @@
+[submodule "personal_infra/puppet/modules/mailalias_core"]
+       path = personal_infra/puppet/modules/mailalias_core
+       url = https://github.com/puppetlabs/puppetlabs-mailalias_core.git
diff --git a/personal_infra/puppet/modules/mailalias_core b/personal_infra/puppet/modules/mailalias_core
new file mode 160000 (submodule)
index 0000000..e6230fa
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit e6230faf076a5ed7b474ed67a4c6c0802d0b7b55
diff --git a/personal_infra/puppet/modules/root_mail/manifests/init.pp b/personal_infra/puppet/modules/root_mail/manifests/init.pp
new file mode 100644 (file)
index 0000000..9faa883
--- /dev/null
@@ -0,0 +1,35 @@
+class root_mail {
+  package {'postfix':}
+  ->
+  service {'postfix':
+    ensure => running,
+    enable => true,
+  }
+
+  # if crond doesn't see /usr/bin/sendmail on startup, it won't send mails
+  Package['postfix']
+  ~>
+  service{"crond":
+    ensure => running,
+  }
+
+  if($facts['os']['family'] == 'RedHat') {
+    if($facts['os']['release']['major'] == '9') {
+      package {'s-nail':}
+    }
+    else {
+      package {'mailx':}
+    }
+  }
+
+  mailalias {'root':
+    recipient => lookup('mail.root_mail'),
+    require => Package['postfix'],
+  }
+  ~>
+  exec {'/usr/sbin/postalias /etc/aliases':
+    creates => '/etc/aliases.db',
+  }
+  ~>
+  Service['postfix']
+}