Skip to content
Snippets Groups Projects
Select Git revision
  • 12e0ce29aa3b6cdb81c8e1fb080fae0ce687c1c4
  • master default protected
  • update-min-openvox-version-07f8cb2
  • cleanup_fixtures
  • add-openvox
  • freebsd-14
  • remove-legacy-top-scope-syntax
  • rel430
  • tests
  • revert-363-augeas-module-cleanup
  • release-4.1.0
  • puppet8
  • relax-dependencies
  • rel400
  • mode
  • puppet7
  • release-3.1.0
  • freebsd13
  • freebsd11
  • stdlib
  • centos
  • v5.1.0
  • v5.0.0
  • v4.5.0
  • v4.4.0
  • v4.3.0
  • v4.2.1
  • v4.2.0
  • v4.1.0
  • v4.0.0
  • v3.1.0
  • v3.0.0
  • v2.0.0
  • 1.12.0
  • 1.11.0
  • 1.10.0
  • 1.9.0
  • 1.8.0
  • 1.7.0
  • 1.6.0
  • 1.5.0
41 results

mta.pp

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    mta.pp 1.76 KiB
    # == Class: postfix::mta
    #
    # This class configures a minimal MTA, delivering mail to
    # $mydestination.
    #
    # Either a valid relay host or the special word 'direct' is required
    # ($relayhost) for outbound email.
    #
    # transport & virtual maps get configured and can be populated with
    # postfix::transport and postfix::virtual
    #
    # === Parameters
    #
    # [*relayhost*]     - (string) the relayhost to use or 'direct' to send mail
    #                     directly without a relay.
    # [*mydestination*] - (string)
    # [*mynetworks*]    - (string)
    #
    # === Examples
    #
    #   class { 'postfix':
    #     relayhost     => 'mail.example.com',
    #     smtp_listen   => '0.0.0.0',
    #     mydestination => '$myorigin, myapp.example.com',
    #     mta           => true,
    #   }
    #
    class postfix::mta (
      $mydestination = $postfix::mydestination,
      $mynetworks    = $postfix::mynetworks,
      $relayhost     = $postfix::relayhost,
    ) {
    
      validate_re($relayhost, '^\S+$',
                  'Wrong value for $relayhost')
      validate_re($mydestination, '^\S+(?:,\s*\S+)*$',
                  'Wrong value for $mydestination')
      validate_re($mynetworks, '^(?:\S+?(?:(?:,\s)|(?:\s))?)*$',
                  'Wrong value for $mynetworks')
    
      # If direct is specified then relayhost should be blank
      if ($relayhost == 'direct') {
        postfix::config { 'relayhost': ensure => 'blank' }
      }
      else {
        postfix::config { 'relayhost': value => $relayhost }
      }
    
      postfix::config {
        'mydestination':       value => $mydestination;
        'mynetworks':          value => $mynetworks;
        'virtual_alias_maps':  value => 'hash:/etc/postfix/virtual';
        'transport_maps':      value => 'hash:/etc/postfix/transport';
      }
    
      postfix::hash { '/etc/postfix/virtual':
        ensure => 'present',
      }
    
      postfix::hash { '/etc/postfix/transport':
        ensure => 'present',
      }
    
    }