Dominic Cleal's Blog

Alternative Augeas-based providers for Puppet

Puppet has a few core types such as host for populating /etc/hosts and mailalias for /etc/aliases that use an internal parsedfile helper. You'll be familiar with this if you've ever seen it announce the following in any file it touches:

# HEADER: This file was autogenerated at Sun Mar 04 17:45:13 +0000 2012
# HEADER: by puppet.  While it can still be managed manually, it
# HEADER: is definitely not recommended.

It also rewrites the entire file, ignoring the whitespace you'd carefully placed in existing entries. While you can simply template the entire file, or use Augeas resources to do it, I wanted to improve the built in types.

So I've released a module called augeasproviders that contains new provider implementations for host and mailalias, using the Augeas library under the covers. Augeas is good at preserving the existing format of the file while reading, editing and adding additional entries (though it can't copy formatting yet).

No Augeas knowledge is necessary, just download, enable pluginsync and set the default provider.

Archives