From 9c745e5bde95cd8e56237a0c806f86e10fd168e1 Mon Sep 17 00:00:00 2001 From: Ed Rude Date: Fri, 2 Aug 2024 11:11:12 -0400 Subject: [PATCH 1/2] make it possible to provide inital seed data for the virtual and transport files that will be setup if you set mta to true --- manifests/init.pp | 28 ++++++++++++++++++++++++++++ manifests/mta.pp | 8 ++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index eb012871..616552e7 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -187,6 +187,22 @@ # A Boolean to define whether to configure Postfix as a mail transfer agent. # This option is mutually exclusive with the satellite Boolean. # +# @param mta_virtual_content +# A free form string that defines the contents of the virtual file. Only used if mta is true. +# This parameter is mutually exclusive with mta_virtual_source. +# +# @param mta_virtual_source +# A String whose value is a location for the source file to be used for the virtual file. +# Only used if mta is true. This parameter is mutually exclusive with mta_virtual_content. +# +# @param mta_transport_content +# A free form string that defines the contents of the transport file. Only used if mta is true. +# This parameter is mutually exclusive with mta_transport_source. +# +# @param mta_transport_source +# A String whose value is a location for the source file to be used for the transport file. +# Only used if mta is true. This parameter is mutually exclusive with mta_transport_content. +# # @param mydestination # A string to define the mydestination parameter in main.cf (postconf(5)). # Example: `example.com, foo.example.com`. @@ -286,6 +302,10 @@ Optional[Array[String[1]]] $masquerade_domains = undef, Optional[Array[String[1]]] $masquerade_exceptions = undef, Boolean $mta = false, + Optional[String] $mta_virtual_content = undef, + Optional[String] $mta_virtual_source = undef, + Optional[String] $mta_transport_content = undef, + Optional[String] $mta_transport_source = undef, String $mydestination = '$myhostname, localhost.$mydomain, localhost', # postfix_mydestination String $mynetworks = '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128', # postfix_mynetworks String $myorigin = $facts['networking']['fqdn'], @@ -371,6 +391,14 @@ include postfix::ldap } + if $mta_virtual_content and $mta_virtual_source { + fail('You must provide either \'mta_virtual_content\' or \'mta_virtual_source\', not both.') + } + + if $mta_transport_content and $mta_transport_source { + fail('You must provide either \'mta_transport_content\' or \'mta_transport_source\', not both.') + } + if $mta { if $satellite { fail('enabling both the $mta and $satellite parameters is not supported. Please disable one.') diff --git a/manifests/mta.pp b/manifests/mta.pp index d3eb41a0..d46bb2af 100644 --- a/manifests/mta.pp +++ b/manifests/mta.pp @@ -51,10 +51,14 @@ } postfix::hash { "${postfix::confdir}/virtual": - ensure => 'present', + ensure => 'present', + content => $postfix::mta_virtual_content, + source => $postfix::mta_virtual_source, } postfix::hash { "${postfix::confdir}/transport": - ensure => 'present', + ensure => 'present', + content => $postfix::mta_transport_content, + source => $postfix::mta_transport_source, } } From 16386a5c2b16d9d93ba74b4e0c83d2740a198daa Mon Sep 17 00:00:00 2001 From: Ed Rude Date: Fri, 2 Aug 2024 12:27:20 -0400 Subject: [PATCH 2/2] update REFERENCE.md --- REFERENCE.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/REFERENCE.md b/REFERENCE.md index bbc59bf3..04ffca69 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -124,6 +124,10 @@ The following parameters are available in the `postfix` class: * [`masquerade_domains`](#-postfix--masquerade_domains) * [`masquerade_exceptions`](#-postfix--masquerade_exceptions) * [`mta`](#-postfix--mta) +* [`mta_virtual_content`](#-postfix--mta_virtual_content) +* [`mta_virtual_source`](#-postfix--mta_virtual_source) +* [`mta_transport_content`](#-postfix--mta_transport_content) +* [`mta_transport_source`](#-postfix--mta_transport_source) * [`mydestination`](#-postfix--mydestination) * [`mynetworks`](#-postfix--mynetworks) * [`myorigin`](#-postfix--myorigin) @@ -477,6 +481,42 @@ This option is mutually exclusive with the satellite Boolean. Default value: `false` +##### `mta_virtual_content` + +Data type: `Optional[String]` + +A free form string that defines the contents of the virtual file. Only used if mta is true. +This parameter is mutually exclusive with mta_virtual_source. + +Default value: `undef` + +##### `mta_virtual_source` + +Data type: `Optional[String]` + +A String whose value is a location for the source file to be used for the virtual file. +Only used if mta is true. This parameter is mutually exclusive with mta_virtual_content. + +Default value: `undef` + +##### `mta_transport_content` + +Data type: `Optional[String]` + +A free form string that defines the contents of the transport file. Only used if mta is true. +This parameter is mutually exclusive with mta_transport_source. + +Default value: `undef` + +##### `mta_transport_source` + +Data type: `Optional[String]` + +A String whose value is a location for the source file to be used for the transport file. +Only used if mta is true. This parameter is mutually exclusive with mta_transport_content. + +Default value: `undef` + ##### `mydestination` Data type: `String`