- Module Description - What the module does and why it is useful
- Setup - The basics of getting started with tagmail
- Usage - Configuration options and additional functionality
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
The tagmail module forwards Puppet log messages as email if the log messages relate to resources that have been assigned specific tags.
This module replaces the Puppet tagmail feature, which was removed as of Puppet Enterprise 3.8.0 and open source Puppet 4.0. This module supports Puppet Enterprise 3.8 and later and open source Puppet 4.0 and later. If you are using older versions of Puppet or Puppet Enterprise, you should use the tagmail feature included in those versions.
The tagmail module is a report processor plugin that lets you sort log messages into email reports by pairing particular tags with particular email addresses. Tags let you set context for resources, classes, and defines. For example, you can assign a tag to all resources associated with a particular operating system, location, or other characteristic. The tag is then included in all log messages related to those resources. Read more about tags.
###Requirements
This module supports Puppet Enterprise and Puppet versions 3.8 or newer. For older versions of Puppet, use Puppet's built-in tagmail feature.
###Beginning with tagmail
-
On each Puppet agent, make sure the
pluginsync
andreport
settings are enabled. (These settings are normally enabled by default.)[agent] report = true pluginsync = true
-
On the Puppet master, make sure the
reports
setting in the master section includes tagmail:[master] reports = tagmail
-
If you use anti-spam controls such as greylisting on your mail server, be sure to whitelist Puppet's sending email address to ensure your tagmail reports are not discarded as spam.
-
In your Puppet confdir on your master, create a tagmail.conf file. This file will contain your email transport config options, as well as the tags themselves.
To configure the tagmail module, edit (or create and edit) the tagmail.conf
in your Puppet confdir.
tagmail.conf
is formatted as an ini file and is formatted like so:
[transport]
reportfrom = [email protected]
smtpserver = smtp.example.org
smtpport = 25
smtphelo = example.org
[tagmap]
all: [email protected]
webserver, !mailserver: [email protected], [email protected]
Instead of specifying smtpserver
, smtpport
and smtphelo
, you can specify the sendmail
option with a path to your sendmail binary (defaulted to /usr/sbin/sendmail
). If you do not specify smtpserver
, tagmail will default to using sendmail.
[transport]
reportfrom = [email protected]
sendmail = /usr/sbin/sendmail
[tagmap]
all: [email protected]
webserver, !mailserver: [email protected], [email protected]
Each line in the [tagmap]
section of tagmail.conf
should include a comma-separated list of tags, a colon, and a comma-separated list of email addresses to receive log messages containing the provided tags.
If you prefix a tag with an exclamation mark, Puppet subtracts any messages with that tag from the line's results.
Puppet's loglevels (debug
, info
, notice
, warning
, err
, alert
, emerg
, crit
, and verbose
) can also be used as tags, and the all
tag always matches every log message.
The above example sends all log messages to [email protected]
, and all messages from webservers that are not also from mailservers to [email protected]
and to [email protected]
.
This module supports Puppet Enterprise and Puppet versions 3.8 or newer. For older versions of Puppet, use Puppet's built-in tagmail feature.
Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can't access the huge number of platforms and myriad hardware, software, and deployment configurations that Puppet is intended to serve. We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
For more information, see our module contribution guide.
To see who's already involved, see the list of contributors.