Skip to content
Snippets Groups Projects
Select Git revision
  • d683197356fc923e94d861540a86d1ba6dd64bf0
  • 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

cert.pp

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    canonical.pp 1.69 KiB
    #== Definition: postfix::canonical
    #
    #Manages content of the /etc/postfix/canonical map.
    #
    #Parameters:
    #- *name*: name of address postfix will lookup. See canonical(5).
    #- *destination*: where the emails will be delivered to. See canonical(5).
    #- *ensure*: present/absent, defaults to present.
    #
    #Requires:
    #- Class["postfix"]
    #- Postfix::Hash["/etc/postfix/canonical"]
    #- Postfix::Config["canonical_maps"] or Postfix::Config["sender_canonical_maps"] or Postfix::Config["recipient_canonical_maps"]
    #- augeas
    #
    #Example usage:
    #
    #  node "toto.example.com" {
    #
    #    include postfix
    #
    #    postfix::hash { "/etc/postfix/recipient_canonical":
    #      ensure => present,
    #    }
    #    postfix::config { "canonical_alias_maps":
    #      value => "hash:/etc/postfix/recipient_canonical"
    #    }
    #    postfix::canonical {
    #      "user@example.com":
    #        file        => "/etc/postfix/recipient_canonical",
    #        ensure      => present,
    #        destination => "root";
    #    }
    #  }
    #
    define postfix::canonical (
      $destination,
      $file=undef,
      $ensure='present'
    ) {
      include postfix
      include ::postfix::augeas
    
      $_file = pick($file, "${postfix::confdir}/canonical")
    
      case $ensure {
        'present': {
          $changes = [
            "set pattern[. = '${name}'] '${name}'",
            "set pattern[. = '${name}']/destination '${destination}'",
          ]
        }
    
        'absent': {
          $changes = "rm pattern[. = '${name}']"
        }
    
        default: {
          fail("Wrong ensure value: ${ensure}")
        }
      }
    
      augeas {"Postfix canonical - ${name}":
        incl    => $_file,
        lens    => 'Postfix_Canonical.lns',
        changes => $changes,
        require => [Package['postfix'], Augeas::Lens['postfix_canonical']],
        notify  => Exec["generate ${_file}.db"],
      }
    }