class mail::postfixadmin( $database_user = hiera('postfixadmin_database_user', 'postfix'), $database_host = hiera('postfixadmin_database_host', 'localhost'), $database_name = hiera('postfixadmin_database_name', 'postfix'), $database_password = hiera('postfixadmin_database_password', ''), ) { # Class configuration case $database_password { '': { fail("You need to define database_password host config") } } # # Database configuration # database::instance { "${database_name}": password => "${database_password}", } # # Postfix configuration # postfix::config { "virtual_transport": value => 'dovecot'; "dovecot_destination_recipient_limit": value => '1', nonstandard => true; } postfix::config { "virtual_mailbox_domains": value => 'proxy:mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf', require => File['/etc/postfix/sql/mysql_virtual_domains_maps.cf'], } postfix::config { "virtual_alias_maps": value => 'hash:/etc/postfix/virtual, regexp:/etc/postfix/virtual_regexp, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf', require => File['/etc/postfix/sql/mysql_virtual_alias_maps.cf', '/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf', '/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf' ], } postfix::config { "virtual_mailbox_maps": value => 'proxy:mysql:/etc/postfix/sql/mysql_virtual_mailbox_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf', require => File['/etc/postfix/sql/mysql_virtual_mailbox_maps.cf', '/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf' ], } # # Map files # file { "/etc/postfix/sql": ensure => directory, owner => postfix, group => root, mode => 0755, } file { "/etc/postfix/sql/mysql_virtual_domains_maps.cf": ensure => present, owner => postfix, mode => 0600, content => template('mail/postfix/sql/mysql_virtual_domains_maps.cf.erb'), require => File['/etc/postfix/sql'], } file { "/etc/postfix/sql/mysql_virtual_alias_maps.cf": ensure => present, owner => postfix, mode => 0600, content => template('mail/postfix/sql/mysql_virtual_alias_maps.cf.erb'), require => File['/etc/postfix/sql'], } file { "/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf": ensure => present, owner => postfix, mode => 0600, content => template('mail/postfix/sql/mysql_virtual_alias_domain_maps.cf.erb'), require => File['/etc/postfix/sql'], } file { "/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf": ensure => present, owner => postfix, mode => 0600, content => template('mail/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf.erb'), require => File['/etc/postfix/sql'], } file { "/etc/postfix/sql/mysql_virtual_mailbox_maps.cf": ensure => present, owner => postfix, mode => 0600, content => template('mail/postfix/sql/mysql_virtual_mailbox_maps.cf.erb'), require => File['/etc/postfix/sql'], } file { "/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf": ensure => present, owner => postfix, mode => 0600, content => template('mail/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf.erb'), require => File['/etc/postfix/sql'], } # # Additional for quota support # #postfix::config { "virtual_mailbox_limit_maps": # value => 'mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf', # require => File['/etc/postfix/mysql_virtual_mailbox_limit_maps.cf'], #} # #postfix::config { "virtual_create_maildirsize": value => 'yes' } #postfix::config { "virtual_mailbox_extended ": value => 'yes' } #postfix::config { "virtual_mailbox_limit_override": value => 'yes' } #postfix::config { "virtual_maildir_limit_message": value => 'The user's maildir has overdrawn his quota, try again later.' } #postfix::config { "virtual_overquota_bounce": value => 'yes' } # #file { "/etc/postfix/mysql_virtual_mailbox_limit_maps.cf": # ensure => present, # owner => postfix, # mode => 0600, # content => template('mail/postfix/sql/mysql_virtual_mailbox_limit_maps.cf.erb'), # require => File['/etc/postfix/sql'], #} }