The tagmail module sends Puppet log messages as email if the log messages relate to resources that have been assigned specific tags. This module provides the same functionality as the tagmail feature that was previously built into Puppet.
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. This module replaces Puppet's built-in tagmail feature, which is broken in the JVM-based PE 3.7 and completely removed in PE 3.8 and Puppet 4.0.
Note that version 1.x of the tagmail module supports only Puppet 3.7 to 3.8 and PE 3.7 to 3.8.1. For newer versions of Puppet or PE, you must upgrade to tagmail 2.0. For older versions of Puppet, use Puppet's built-in tagmail feature.
This module is not supported or maintained by Puppet and does not qualify for Puppet Support plans. It's provided without guarantee or warranty and you can use it at your own risk. All bugfixes, updates, and new feature development will come from community contributions. [tier:community]
This module supports Puppet Enterprise and Puppet versions 3.8 or newer. For older versions of Puppet, use Puppet's built-in tagmail feature.
On each Puppet agent, make sure the pluginsync
and report
settings are enabled. (These settings are normally enabled by default.)
[main]
report = true
pluginsync = true
On the Puppet server, include tagmail in the reports
setting in the server section:
[server]
tagmap = $confdir/tagmail.conf
reports = puppetdb,console,tagmail
If you use anti-spam controls such as grey-listing on your mail server, allowlist Puppet's sending email address to ensure your tagmail reports are not discarded as spam. This setting is controlled by the reportfrom
setting in puppet.conf
.
In the Puppet confdir on your server, create a tagmail.conf
file. This file will contain your email transport config options, as well as the tags themselves.
Tags let you set context for resources, classes, and defined types. 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.
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. To learn more about tags, see tags in the Puppet Language docs.
tagmail.conf
To configure the tagmail module, edit the tagmail.conf
file you created in Step 4 above. This file is located in your Puppet confdir. The tagmail.conf
should be formatted as an ini file.
Open tagmail.conf
in your text editor and add create [transport]
and [tagmap]
sections.
In the [transport]
section, specify either:
sendmail
, with a path to your sendmail binary (by default, /usr/sbin/sendmail
).smtpserver
, smtpport
, and smtphelo
. If you do not specify smtpserver
, tagmail defaults to using sendmail
.In the [tagmap]
section , specify tags and email addresses. Each line should include both:
For example, this tagmail.conf
sends all log messages to me@example.com
, and all messages from webservers that are not also mailservers to httpadmins@example.com
and to you@example.com
:
[transport]
reportfrom = reports@example.org
smtpserver = smtp.example.org
smtpport = 25
smtphelo = example.org
[tagmap]
all: me@example.com
webserver, !mailserver: httpadmins@example.com, you@example.com
If you specify sendmail
instead of smtpserver
, it might look like:
[transport]
reportfrom = reports@example.org
sendmail = /usr/sbin/sendmail
[tagmap]
all: me@example.com
webserver, !mailserver: httpadmins@example.com, you@example.com
For an extensive list of supported operating systems, see metadata.json
This module should be used only if you're using the JVM on the Puppet server. For older versions of Puppet, or if using the legacy Puppet server on Apache/Rack/Passenger, use Puppet's built-in tagmail feature.
Puppet 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.