markt-de / puppet-postfix Goto Github PK
View Code? Open in Web Editor NEWThis project forked from jiuka/puppet-postfix
Puppet module to configure Postfix with multi instance support
Home Page: https://forge.puppet.com/oxc/postfix/
This project forked from jiuka/puppet-postfix
Puppet module to configure Postfix with multi instance support
Home Page: https://forge.puppet.com/oxc/postfix/
On an initial Puppet run (i.e. from a vanilla OS) using puppet apply
locally (masterless):
Error: Could not find a suitable provider for postconf_master
On the following Puppet run:
Notice: /Stage[main]/Custom::Profile::Clamav/Postconf_master[amavis/unix]/ensure: created
Notice: /Stage[main]/Custom::Profile::Clamav/Postconf_master[127.0.0.1:10025/inet]/ensure: created
When running on RHEL6.
Error: /Stage[main]/Postfix::Config/Resources[postconf_master]: Failed to generate additional resources using 'generate': undefined method `scan' for nil:NilClass
Failed to generate additional resources using 'generate': undefined method `scan' for nil:NilClass
Source: /Stage[main]/Postfix::Config/Resources[postconf_master]File: /etc/puppetlabs/xx/xx/modules/postfix/manifests/config.ppLine: 10
postfix::main_config:
mydomain: 'xxx
myorigin: '$mydomain'
mydestination: ''
smtp_connect_timeout: '120s'
inet_protocols: 'ipv4'
relayhost: xxx
inet_interfaces: 'loopback-only'
local_transport: 'error:local delivery is disabled'
smtp_generic_maps: 'hash:/etc/postfix/generic'
The module should have a simple config parameter that removes all unmanaged entries from main.cf and master.cf
Please let me know when this module is released on the puppet forge under the new namespace, so I can deprecate the old module.
First of all, thanks for this useful module!
I noticed postfix isn't reloaded or restarted after some settings have changed.
This is on Ubuntu 14.04 with Puppet 4.10 and Hiera 5.
Version 1.0.1 of the oxc-postfix module, configure via Hiera.
At first I though that perhaps service_manage was disabled, but according to Hiera lookup it definitely is 'true' and the restart_cmd is set correctly for Ubuntu.
$ sudo /opt/puppetlabs/bin/puppet lookup 'postfix::service_manage' --environment=production --node=i-046a905500cd5973f.www15.eu-west-1
--- true
$ sudo /opt/puppetlabs/bin/puppet lookup 'postfix::restart_cmd' --environment=production --node=i-046a905500cd5973f.www15.eu-west-1
--- "/etc/init.d/postfix reload"
The agent's debug logs shows there's a refresh event propagated but appears it's never acted upon.
Notice: /Stage[main]/Postfix::Config/Postconf[compatibility_level]/ensure: created
Debug: Executing: '/usr/sbin/postconf compatibility_level=2'
Debug: /Stage[main]/Postfix::Config/Postconf[compatibility_level]: The container Class[Postfix::Config] will propagate my refresh event
Debug: Class[Postfix::Config]: The container Stage[main] will propagate my refresh event
Debug: Service[postfix](provider=upstart): Could not find postfix.conf in /etc/init
Debug: Service[postfix](provider=upstart): Could not find postfix.conf in /etc/init.d
Debug: Service[postfix](provider=upstart): Could not find postfix in /etc/init
Debug: Executing: '/usr/sbin/service postfix status'
Here's another example from puppet agent -t
. Some obvious changes, but no reload.
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for i-046a905500cd5973f.www15.eu-west-1
Info: Applying configuration version 'puppet-production-054ed3c5531'
Notice: /Stage[main]/Postfix::Config/Postconf[config_directory]/ensure: removed
Notice: /Stage[main]/Postfix::Config/Postconf[compatibility_level]/ensure: created
Notice: Applied catalog in 21.48 seconds
I haven't looked into this in detail yet, shouldn't the relationship between the postfix::config and postfix::service classes have a notify "~>" instead of a require "->"?
So in init.pp
:
Class { '::postfix::package': }
-> Class { '::postfix::config': }
-> Class { '::postfix::service': }
should become:
Class { '::postfix::package': }
-> Class { '::postfix::config': }
~> Class { '::postfix::service': }
Let me know what you think please?
Example code:
postmulti { 'postfix-foo':
group => 'bar'
} ->
postconf { 'foo::myhostname':
value => 'foo.bar',
}
Output:
Notice: Compiled catalog for example in environment production in 0.03 seconds
Info: Using environment 'production'
Info: Applying configuration version '1691590533'
Notice: /Stage[main]/Main/Postconf[foo::myhostname]/ensure: created
Notice: Applied catalog in 0.10 seconds
The postconf resource will always be "created", because prefetching values of multi instances does not seem to work.
The postconf and postconf_master resources are currently not very usable from hiera. This should be made easier for common use cases.
Using this module it is possible to configure parameters that are unsupported by the installed postfix. However, it seems to be impossible to remove these parameters:
Error: /Stage[main]/Resources[postconf]: Failed to generate additional resources using 'generate':
Parameter parameter failed on Postconf[/usr/sbin/postconf:
warning: /etc/postfix/main.cf: unused parameter: smtputf8_enable]:
Invalid value "/usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: smtputf8_enable".
Valid values match /^([^\/]+::)?[a-zA-Z0-9]+(?:_[a-zA-Z0-9]+)*$/.
In this example I've tried to configure a parameter on postfix 2.x which was only introduced in postfix 3.x.
Any idea how to properly remove these parameters with your module? :)
When given a long string, the SMTP banner hiera value gives a corrective change every time puppet is run.
Works:
smtpd_banner: '$myhostname ESMTP $mail_name'
Not working:
value changed $myhostname ESMTP $mail_name - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. to $myhostname ESMTP $mail_name - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
Have tried:
single quotes
double quotes
no quotes
using | for yaml wouldnt work in this case.
Its just one long string not multiline.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.