We're starting to use Puppet as a way of managing configuration across our various servers. We have a Portage repository with a few packages of our own, with each machine using Layman to manage the overlays.
It's easy enough to install packages in puppet, but how should we make sure Layman is configured? Is there a module out there?
I don't know the gentoo, portage or layman specifics, and I don't see any existing modules in the puppet module forge but from a quick look at some gentoo layman documentation it looks like it would be fairly straightforward to write it yourself with Puppet:
Instead of using stages you could instead have
require => Class[layman]
on all thepackage
statements that need it. Using require is more verbose; I'd use it if I only needed a few things, or if I was requiring a specific overlay. I believe you should generally avoid using requires that cross stage boundaries, however, as it's both redundant and likely to tickle weird bugs.Alternate, depending on what you need, avoids stages and only does explicit require ordering. I do stuff like this with RHEL and yum repos:
Further to freiheit's answer, here's what I ended up with.
Note that the 'layman-list' exec is there to overcome what appears to be a bug in the version of layman on Gentoo that prevents overlays from working until they've been listed.
Puppet can choose to run commands in any random order, so the order of the various tasks is enforced with all the
require
entries. To make sure a task happens after this one, use arequire
like so:It needs this definition of
line
from the Puppet wiki to let you edit single lines of a bigger file: