voxpupuli / puppet-postfix

Puppet postfix module
Apache License 2.0
70 stars 174 forks source link

Add FreeBSD support #288

Closed smortex closed 3 years ago

smortex commented 3 years ago

Prerequisites:

igalic commented 3 years ago

are you planning on handling mailer.conf(5) as part of the installation as well?

smortex commented 3 years ago

@igalic I put it in my profile::osfamily::freebsd, included by profile::base which is part of all my roles. I also added some code to disable Sendmail which is the default MTA on FreeBSD. I am not sure what is the best to do: the Sendmail stuff does not belong to a Postfix profile; and I guess one can possibly install Postfix for some things but rely on Sendmail otherwise :shrug: I am really open to suggestions regarding this!

Here is a snippet from my profile for reference:

class profile::osfamily::freebsd inherits profile::osfamily::unix {
  # [...]
  file { '/usr/local/etc/mail/mailer.conf':
    ensure  => file,
    owner   => 'root',
    group   => 'wheel',
    mode    => '0644',
    source  => '/usr/local/share/postfix/mailer.conf.postfix',
    require => Package['postfix'],
  }

  # {{{ Disable sendmail
  service { 'sendmail':
    ensure => stopped,
    before => Service['postfix'],
  }
  -> file_line { 'sendmail_enable':
    ensure => present,
    path   => '/etc/rc.conf',
    line   => 'sendmail_enable="NONE"',
    match  => '^sendmail_enable=',
  }

  file_line { '/etc/periodic.conf-daily_clean_hoststat_enable':
    path  => '/etc/periodic.conf',
    line  => 'daily_clean_hoststat_enable="NO"',
    match => '^daily_clean_hoststat_enable=',
  }

  file_line { '/etc/periodic.conf-daily_status_mail_rejects_enable':
    path  => '/etc/periodic.conf',
    line  => 'daily_status_mail_rejects_enable="NO"',
    match => '^daily_status_mail_rejects_enable=',
  }

  file_line { '/etc/periodic.conf-daily_status_include_submit_mailq':
    path  => '/etc/periodic.conf',
    line  => 'daily_status_include_submit_mailq="NO"',
    match => '^daily_status_include_submit_mailq=',
  }

  file_line { '/etc/periodic.conf-daily_submit_queuerun':
    path  => '/etc/periodic.conf',
    line  => 'daily_submit_queuerun="NO"',
    match => '^daily_submit_queuerun=',
  }
  # }}}
  # [...]
}
igalic commented 3 years ago

https://codeberg.org/daemonpuppet/sysrc i have a module for rc.conf stuff, that could also probably also be used for periodic.conf, but it's undocumented as of yet