From 1d4afa1195f8fa6b41acc5c4e0cc9727cf82d9fa Mon Sep 17 00:00:00 2001 From: Ed Rude Date: Fri, 2 Aug 2024 11:11:12 -0400 Subject: [PATCH] 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 | 24 ++++++++++++++++++++++++ manifests/mta.pp | 8 ++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index eb012871..2a425a0d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -187,6 +187,18 @@ # 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 +298,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 +387,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, } }