Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FreeBSD support #288

Merged
merged 9 commits into from Feb 3, 2021
Merged

Add FreeBSD support #288

merged 9 commits into from Feb 3, 2021

Conversation

smortex
Copy link
Member

@smortex smortex commented Nov 9, 2020

Prerequisites:

@igalic
Copy link
Contributor

igalic commented Nov 9, 2020

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

@smortex
Copy link
Member Author

smortex commented Nov 10, 2020

@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 🤷 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
Copy link
Contributor

igalic commented Nov 10, 2020

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

manifests/canonical.pp Outdated Show resolved Hide resolved
In order to bring support for FreeBSD, do not use the hardcoded
/etc/postfix path for the directory containing Postfix configuration:
FreeBSD ports are installed with a /usr/local/ prefix (by default) so
the configuration files on FreeBSD are stored in the
/usr/local/etc/postfix directory.
FreeBSD does not have a "root" group.  The corresponding group is named
"wheel".

Allow to setup a custom "root_group", and adjust FreeBSD configuration
to set it to "wheel".
@smortex smortex force-pushed the freebsd branch 3 times, most recently from 4eeca9c to 75f7389 Compare January 20, 2021 23:13
@smortex smortex marked this pull request as ready for review January 20, 2021 23:13
@@ -93,6 +93,9 @@
# }
#
class postfix (
Stdlib::Absolutepath $confdir,
Boolean $manage_mailname,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you put this together with the other manage_* boolean parameters below, and default to true here instead of in common.yaml (just for the sake of homogeneity)?

Copy link
Member Author

@smortex smortex Jan 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about $manage_aliases and $manage_root_alias ? :trollface:

They are a bit out of scope of this PR…

manifests/init.pp Outdated Show resolved Hide resolved
manifests/canonical.pp Outdated Show resolved Hide resolved
manifests/files.pp Outdated Show resolved Hide resolved
manifests/conffile.pp Outdated Show resolved Hide resolved
manifests/packages.pp Outdated Show resolved Hide resolved
manifests/satellite.pp Outdated Show resolved Hide resolved
manifests/service.pp Outdated Show resolved Hide resolved
Some resources parameters depend on the value of variable from the
postfix class.  Ensure these values are substitued only after including
postfix.
These values are system-dependent, but this helps seeing the usual
default value when genering references.
manifests/files.pp Outdated Show resolved Hide resolved
manifests/conffile.pp Outdated Show resolved Hide resolved
Co-authored-by: Raphaël Pinson <github+aem1eeshi1@raphink.net>
@raphink raphink added the enhancement New feature or request label Feb 3, 2021
@raphink raphink merged commit 2d1906b into voxpupuli:master Feb 3, 2021
@smortex smortex deleted the freebsd branch February 3, 2021 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants