init.pp (Источник)

class mail (
	$dbtype = '',
	$dbserver = '',
	$dbuser = '',
	$dbpass = '',
	$dbname = '',
	$dbport = ''
	){
        $mail_deps=["postfix",
                   "postfix-mysql",
                   "postfix-doc",
                   "dovecot-common",
                   "dovecot-imapd",
                   "dovecot-pop3d",
                   "libsasl2-2",
                   "libsasl2-modules",
                   "libsasl2-modules-sql",
                   "sasl2-bin",
                   "libpam-mysql",
		   #"php5-mcrypt",
		   "php5-intl",
		   "spamassassin",
		   "amavisd-new",
		   "postgrey",
		   "clamav",
		   "clamav-daemon",
		   "imapproxy",
		   "dovecot-managesieved",
                   "openssl",]

package { $mail_deps:
	ensure 	=> "installed",
	}

group	{ "vmail":
	gid	=> 1000,
	}

file	{ "/var/vmail":
	ensure	=> "directory",
	owner 	=> "vmail",
	group	=> "vmail",
	}

user	{ "vmail":
	home 	=> "/var/vmail",
	uid	=> 1000,
	gid	=> 1000,
	}

user	{ "clamav":
	groups	=> amavis,
	}

file    { "/etc/postfix/mysql":
        ensure  => "directory",
        }

file    { "/etc/postfix/mysql/relay_domains.cf":
        ensure  => file,
        content => template("mail/relay_domains.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

file    { "/etc/postfix/mysql/virtual_alias_domain_maps.cf":
        ensure  => file,
        content => template("mail/virtual_alias_domain_maps.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

file    { "/etc/postfix/mysql/virtual_alias_maps.cf":
        ensure  => file,
        content => template("mail/virtual_alias_maps.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

file    { "/etc/postfix/mysql/virtual_mailbox_domains.cf":
        ensure  => file,
        content => template("mail/virtual_mailbox_domains.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

file    { "/etc/postfix/mysql/virtual_mailbox_maps.cf":
        ensure  => file,
        content => template("mail/virtual_mailbox_maps.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

file    { "/etc/postfix/main.cf":
        ensure  => file,
        content => template("mail/main.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

file    { "/etc/postfix/master.cf":
        ensure  => file,
        content => template("mail/master.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

service { "postfix":
        ensure  => "running",
        enable  => "true",
        hasrestart => true,
        subscribe => File["/etc/postfix/main.cf"],
        }

file    { "/etc/dovecot/conf.d/10-auth.conf":
        ensure  => file,
        content => template("mail/10-auth.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

file    { "/etc/dovecot/conf.d/10-mail.conf":
        ensure  => file,
        content => template("mail/10-mail.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

file    { "/etc/dovecot/conf.d/10-master.conf":
        ensure  => file,
        content => template("mail/10-master.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

file    { "/etc/dovecot/conf.d/10-ssl.conf":
        ensure  => file,
        content => template("mail/10-ssl.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

file    { "/etc/dovecot/conf.d/15-lda.conf":
        ensure  => file,
        content => template("mail/15-lda.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

file    { "/etc/dovecot/conf.d/20-imap.conf":
        ensure  => file,
        content => template("mail/20-imap.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

file    { "/etc/dovecot/conf.d/20-managesieve.conf":
        ensure  => file,
        content => template("mail/20-managesieve.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

file    { "/etc/dovecot/conf.d/90-plugin.conf":
        ensure  => file,
        content => template("mail/90-plugin.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

file    { "/etc/dovecot/conf.d/90-sieve.conf":
        ensure  => file,
        content => template("mail/90-sieve.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

file    { "/etc/dovecot/dovecot-sql.conf.ext":
        ensure  => file,
        content => template("mail/dovecot-sql.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

service { "dovecot":
        ensure  => "running",
        enable  => "true",
        hasrestart => true,
        subscribe => File["/etc/dovecot/conf.d/10-auth.conf"],
        }

file    { "/etc/default/spamassassin":
        ensure  => file,
        content => template("mail/spamassassin.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

file    { "/etc/mail/spamassassin/local.cf":
        ensure  => file,
        content => template("mail/spam_local.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

service { "spamassassin":
        ensure  => "running",
        enable  => "true",
        hasrestart => true,
        subscribe => File["/etc/mail/spamassassin/local.cf"],
        }

file    { "/etc/amavis/conf.d/15-content_filter_mode":
        ensure  => file,
        content => template("mail/15-content_filter_mode.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

service { "amavis":
        ensure  => "running",
        enable  => "true",
        hasrestart => true,
        subscribe => File["/etc/amavis/conf.d/15-content_filter_mode"],
        }

file    { "/etc/imapproxy.conf":
        ensure  => file,
        content => template("mail/imapproxy.erb"),
        owner   => root,
        group   => root,
        mode    => 644,
        }

service { "imapproxy":
        ensure  => "running",
        enable  => "true",
        hasrestart => true,
        subscribe => File["/etc/imapproxy.conf"],
        }
}