Skip to content
Snippets Groups Projects
Select Git revision
  • f8173ce67ac2e15258330f0e44d78d1ecaf38583
  • master default protected
  • 5.x
  • ll-php8-bs5
  • release_5_bs5
  • ll-php8
  • 4.x
  • laminas_migration
  • release_1.0.0.2
  • release_4.0.0
  • release_3.2.8
  • bootstrap4_migration
  • 1.0.0.3
  • 6.0.7
  • 6.0.6
  • 6.0.5
  • 6.0.4
  • 6.0.3
  • 6.0.2
  • 6.0.1
  • 5.1.1
  • 6.0.0
  • 5.1.0
  • 5.0.0
  • 4.0.2
  • 3.2.11
  • 4.0.1
  • 3.2.10
  • 4.0.0
  • 1.0.0.2
  • 3.2.9
  • 3.2.8
32 results

Module.php

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    postfix-mta.pp 1.63 KiB
    #
    # == Class: postfix::mta
    #
    # This class configures a minimal MTA, listening on
    # $postfix_smtp_listen (default to localhost) and delivering mail to
    # $postfix_mydestination (default to $fqdn).
    #
    # A valid relay host is required ($postfix_relayhost) for outbound email.
    #
    # transport & virtual maps get configured and can be populated with
    # postfix::transport and postfix::virtual
    #
    # Parameters:
    # - *$postfix_relayhost*
    # - *$postfix_mydestination*
    # - every global variable which works for class "postfix" will work here.
    #
    # Example usage:
    #
    #   node "toto.example.com" {
    #     $postfix_relayhost = "mail.example.com"
    #     $postfix_smtp_listen = "0.0.0.0"
    #     $postfix_mydestination = "\$myorigin, myapp.example.com"
    #
    #     include postfix::mta
    #
    #     postfix::transport { "myapp.example.com":
    #       ensure => present,
    #       destination => "local:",
    #     }
    #   }
    #
    class postfix::mta {
    
      case $postfix_relayhost {
        "":   { fail("Required \$postfix_relayhost variable is not defined.") }
      }
    
      case $postfix_mydestination {
        "": { $postfix_mydestination = "\$myorigin" }
      }
    
      include postfix
    
      postfix::config {
        "mydestination":                        value => $postfix_mydestination;
        "mynetworks":                           value => "127.0.0.0/8";
        "relayhost":                            value => $postfix_relayhost;
        "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,
      }
    
    }