class mail::sympa { # Class configuration $database_password = hiera('sympa_database_password', '') $database_name = hiera('sympa_database_name', 'sympa') $database_host = hiera('sympa_database_host', 'localhost') $listmasters = hiera('sympa_listmasters', "listmaster@${fqdn}") $lang = hiera('sympa_lang', 'en_US') $subdomain = hiera('sympa_subdomain', 'lists') $logo_html_definition = hiera('sympa_logo_html_definition', '') case $database_password { '': { fail("You need to define database_password host config") } } # Sympa subsystems include mail::web::sympa include mail::packages::sympa # # Database configuration # database::instance { "${database_name}": password => "${database_password}", privileges => $::lsbdistcodename ? { 'lenny' => 'all', default => [ 'alter_priv', 'alter_routine_priv', 'create_priv', 'create_routine_priv', 'create_tmp_table_priv', 'create_view_priv', 'delete_priv', 'drop_priv', 'event_priv', 'execute_priv', 'grant_priv', 'index_priv', 'insert_priv', 'lock_tables_priv', 'references_priv', 'select_priv', 'show_view_priv', 'trigger_priv', 'update_priv' ], } } group { 'sympa': ensure => present, } user { 'sympa': ensure => present, gid => 'sympa', require => Group['sympa'], } service { "sympa": ensure => running, enable => true, hasstatus => false, pattern => '/usr/lib/sympa/bin/sympa.pl', } file { "/etc/sympa": ensure => directory, owner => postfix, group => root, mode => 0755, } file { "/etc/sympa/sympa.conf": ensure => present, owner => sympa, group => sympa, mode => 0640, content => template("mail/sympa/sympa.conf.${::lsbdistcodename}.erb"), require => [ File['/etc/sympa'], User['sympa'] ], notify => Service['apache', 'sympa'], } file { "/etc/dbconfig-common": ensure => directory, owner => root, group => root, mode => 0755, } file { "/etc/dbconfig-common/sympa.conf": ensure => present, owner => root, group => root, mode => 0600, content => template("mail/sympa/dbconfig-common.${::lsbdistcodename}.erb"), require => File['/etc/dbconfig-common'], } file { "/etc/logrotate.d/sympa": ensure => present, owner => root, group => root, mode => 0644, source => "puppet:///modules/mail/sympa/logrotate", } # gracefully restart sympa everyday cron { "sympa-restart": command => "/etc/init.d/sympa restart > /dev/null 2>&1", user => root, hour => "*/3", minute => "0", ensure => present, require => Service['sympa'], } postfix::transport_regexp_snippet { 'sympa_transport_regexp': content => template('mail/postfix/sympa/transport_regexp.erb'), } postfix::virtual_regexp_snippet { 'sympa_virtual_regexp': content => template('mail/postfix/sympa/virtual_regexp.erb'), } postfix::config { "sympa_destination_recipient_limit": value => '1', nonstandard => true; "sympabounce_destination_recipient_limit": value => '1', nonstandard => true; } mailalias { "sympa": recipient => "|/usr/lib/sympa/bin/queue sympa", notify => Exec["newaliases"], } mailalias { "sympa-request": recipient => "postmaster", notify => Exec["newaliases"], } mailalias { "sympa-owner": recipient => "postmaster", notify => Exec["newaliases"], } mailalias { "listmaster": recipient => "postmaster", notify => Exec["newaliases"], } mailalias { "postmaster": recipient => "root", notify => Exec["newaliases"], } mailalias { "abuse-feedback-report": recipient => "|/usr/lib/sympa/bin/bouncequeue sympa", notify => Exec["newaliases"], } mailalias { "bounce+*": recipient => "|/usr/lib/sympa/bin/bouncequeue sympa", notify => Exec["newaliases"], } # # Listserv compatibility # mailalias { "listserv": recipient => "sympa", notify => Exec["newaliases"], } mailalias { "listserv-request": recipient => "sympa-request", notify => Exec["newaliases"], } mailalias { "listserv-owner": recipient => "sympa-owner", notify => Exec["newaliases"], } mailalias { "majordomo": recipient => "sympa", notify => Exec["newaliases"], } } class mail::sympa::disabled inherits mail::sympa { include mail::web::sympa::disabled Service["sympa"] { ensure => stopped, enable => false, } Cron["sympa-restart"] { ensure => absent, } Postfix::Transport_regexp_snippet['sympa_transport_regexp'] { content => undef, } Postfix::Virtual_regexp_snippet['sympa_virtual_regexp'] { content => undef, } Mailalias["sympa"] { ensure => absent, } Mailalias["sympa-request"] { ensure => absent, } Mailalias["sympa-owner"] { ensure => absent, } Mailalias["abuse-feedback-report"] { ensure => absent, } Mailalias["bounce+*"] { ensure => absent, } Mailalias["listserv"] { ensure => absent, } Mailalias["listserv-request"] { ensure => absent, } Mailalias["listserv-owner"] { ensure => absent, } Mailalias["majordomo"] { ensure => absent, } }