Skip to content
Snippets Groups Projects
Select Git revision
  • 96d7bafdf805fb9fbf2b24ffdbc6eb351d6ffbf3
  • master default protected
  • main
  • update_github_actions
  • 144_rocky8_support
  • 195-update-pdk-to-300
  • 144-rocky8
  • add_test_github_test_workflow
  • pdk_2.4.0
  • fix_unclosed_let_block_in_defines_client_spec
  • validation_fixes
  • freeradius_3_0_21_config_updates
  • data_types
  • PrepareBuster
  • travis
  • 4.0.1
  • 4.0.0
  • 3.9.2
  • 3.9.1
  • 3.9.0
  • 3.8.2
  • 3.8.1
  • 3.8.0
  • 3.7.0
  • 3.6.0
  • 3.5.0
  • 3.4.3
  • 3.4.2
  • 3.4.1
  • 3.4.0
  • 3.3.0
  • 3.2.0
  • 3.1.0
  • 3.0.0
  • 2.3.1
35 results

template.header

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',
      }
    
    }