Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #4 from cjeanneret/service-management

Service management
  • Loading branch information...
commit 39fa735c4654b231086fa804e5325bcba152a978 2 parents bf20b20 + 5b12e1a
@cjeanneret cjeanneret authored
View
4 manifests/checkpw.pp
@@ -1,10 +1,10 @@
-define mailman::checkpw($ensure=present, $mailman_bin="/usr/lib/mailman/bin", $name, $url, $password) {
+define mailman::checkpw($ensure=present, $mailman_bin='/usr/lib/mailman/bin', $name, $url, $password) {
#Note: URL must look like http://lists.domain.ltd/cgi-bin/mailman/admin/${list_name}
exec {"Change mailman list password of ${name}":
command => "${mailman_bin}/change_pw --quiet --listname=${name} --password=${password}",
unless => "/usr/bin/curl -s ${url}/${name} -d 'admlogin=Let%20me%20in...&adminpw=${password}' | grep -q logout",
- require => Package["curl"],
+ require => Package['curl'],
}
}
View
2  manifests/config.pp
@@ -13,7 +13,7 @@
concat::fragment {$name:
ensure => $ensure,
target => "/var/lib/mailman/lists/${mlist}/puppet-config.conf",
- content => template("mailman/config_list.erb"),
+ content => template('mailman/config_list.erb'),
notify => Exec["load configuration $variable on $mlist"],
require => [Class["mailman"], Maillist[$mlist]],
}
View
20 manifests/domain.pp
@@ -1,18 +1,18 @@
define mailman::domain ($ensure, $vhost, $urlpath="/cgi-bin/mailman/") {
- postfix::transport {"${name}":
+ postfix::transport {$name:
ensure => present,
- destination => "mailman",
+ destination => 'mailman',
}
- file {"/etc/mailman/mm_cfg.py":
- ensure => present,
- content => template("mailman/mm_cfg.py.erb"),
- require => Package["mailman"],
+ file {'/etc/mailman/mm_cfg.py':
+ ensure => present,
+ content => template('mailman/mm_cfg.py.erb'),
+ require => Package['mailman'],
}
- file {"/etc/mailman/apache.conf":
- ensure => present,
- content => template("mailman/apache.conf.erb"),
- require => Package["mailman"],
+ file {'/etc/mailman/apache.conf':
+ ensure => present,
+ content => template('mailman/apache.conf.erb'),
+ require => Package['mailman'],
}
}
View
38 manifests/init.pp
@@ -1,26 +1,26 @@
-class mailman {
- package {"mailman":
- ensure => present,
- }
+class mailman($mailman_password, $postmaster="postmaster@${::domain}") {
- service {"mailman":
- ensure => running,
- require => Package["mailman"],
+ package {'mailman':
+ ensure => present,
}
- exec {"mailman set password":
- command => "/usr/sbin/mmsitepass ree2tahG",
- creates => "/var/lib/mailman/data/adm.pw",
- require => Package["mailman"],
+ service {'mailman':
+ ensure => running,
+ require => Package['mailman'],
+ hasstatus => false,
+ hasrestart => true,
+ pattern => '/usr/lib/mailman/bin/mailmanctl -s -q start',
}
- # BUG: I couldn't get this type to work...
-
- #maillist {"mailman":
-
- if $mailmanowner {
- $postmaster = $mailmanowner
- } else {
- $postmaster = "postmaster@camptocamp.com"
+ # Based on mmsitepass python script, we do not need to use it
+ # as it simply output the SHA1 in a file. This file cannot be configured
+ # in mailman options. We just have to take care of the file rights.
+ $hased_pass = sha1($mailman_password)
+ file {'/var/lib/mailman/data/adm.pw':
+ ensure => present,
+ owner => 'root',
+ group => 'list',
+ mode => '0640',
+ content => $hased_pass,
}
}
View
15 manifests/instance.pp
@@ -1,16 +1,15 @@
-define mailman::instance ($ensure=present, $vhost, $urlpath="/cgi-bin/mailman/") {
- mailman::vhost {"${vhost}":
+define mailman::instance ($ensure=present, $vhost, $urlpath='/cgi-bin/mailman/') {
+ mailman::vhost {$vhost:
ensure => $ensure,
}
- mailman::domain {"${name}":
- ensure => $ensure,
- vhost => $vhost,
+ mailman::domain {$name:
+ ensure => $ensure,
+ vhost => $vhost,
urlpath => $urlpath,
}
- postfix::config {"relay_domains":
+ postfix::config {'relay_domains':
ensure => $ensure,
- value => "${name}",
+ value => $name,
}
-
}
View
4 manifests/vhost.pp
@@ -1,7 +1,7 @@
define mailman::vhost ($ensure) {
file {"/var/www/$name/conf/mailman.conf":
ensure => $ensure,
- content => template("mailman/mailman-vhost.erb"),
- notify => Service["apache2"],
+ content => template('mailman/mailman-vhost.erb'),
+ notify => Service['apache2'],
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.