aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Filion <gabster@lelutin.ca>2015-03-11 18:52:30 -0400
committerGabriel Filion <gabster@lelutin.ca>2015-03-11 18:52:30 -0400
commit34d35a25b855b920c6e53245144d7d0276e29aa0 (patch)
treec3d3dac36506bb73099e1347240d22d6c4b0a95d
parent093b7701167304a28d31db7a45c51bba09e5a10a (diff)
parent3c89b7deacffa570d03282368689069f388170de (diff)
downloadpuppet-postfix-34d35a25b855b920c6e53245144d7d0276e29aa0.tar.gz
puppet-postfix-34d35a25b855b920c6e53245144d7d0276e29aa0.tar.bz2
Merge branch 'smtp_auth'
-rw-r--r--manifests/smtp_auth.pp37
1 files changed, 37 insertions, 0 deletions
diff --git a/manifests/smtp_auth.pp b/manifests/smtp_auth.pp
new file mode 100644
index 0000000..b553fb5
--- /dev/null
+++ b/manifests/smtp_auth.pp
@@ -0,0 +1,37 @@
+# == Definition: postfix::smtp_auth
+#
+# Manages content of the /etc/postfix/smtp_auth map.
+#
+# Requires:
+# - Class["postfix"]
+# - Postfix::Hash["/etc/postfix/smtp_auth"]
+# - file_line (from puppetlab's stdlib module)
+#
+# Example usage:
+#
+# node 'toto.example.com' {
+#
+# include postfix
+#
+# postfix::hash { '/etc/postfix/smtp_auth':
+# ensure => present,
+# }
+# postfix::config { 'smtp_auth_maps':
+# value => 'hash:/etc/postfix/smtp_auth'
+# }
+# postfix::smtp_auth { 'gmail.com':
+# ensure => present,
+# user => 'USER',
+# password => 'PW',
+# }
+# }
+
+define postfix::smtp_auth ($user, $password, $ensure=present) {
+ file_line { $name:
+ ensure => $ensure,
+ path => '/etc/postfix/smtp_auth',
+ line => "${name} ${user}:${password}",
+ notify => Exec['generate /etc/postfix/smtp_auth.db'],
+ require => Package['postfix'],
+ }
+}