Puppet class dependecies?

Hi,
I'm currently setting up openstack using foreman and puppet and I've run
into a problem that I do not know how to solve.

The issue is that I assigned the class openstack::controller to the node
with a bunch of parameters but before that I need to install a repo first
(Red Hat RDO) so that openstack::controller installs the correct package
versions.

How do I define this dependency in foreman?

Regards,
Dennis

You're not able to from Foreman as it can't express the dependency
through Puppet's ENC interface. The usual solution is to introduce a
third class, which you might call a role or profile class, and then
include this from Foreman instead.

You could either have the new class include the other two directly, and
then only include role::openstack from Foreman:

class role::openstack {
class { 'repos::rdo': } -> class { 'openstack::controller': }
}

Or if the classes are already included by Foreman or another mechanism,
you can just reference them:

Class['repos::rdo'] -> Class['openstack::controller']

(This line could actually be placed anywhere relevant.)

Regards,

··· On 18/04/13 13:34, Dennis Jacobfeuerborn wrote: > Hi, > I'm currently setting up openstack using foreman and puppet and I've run > into a problem that I do not know how to solve. > > The issue is that I assigned the class openstack::controller to the node > with a bunch of parameters but before that I need to install a repo > first (Red Hat RDO) so that openstack::controller installs the correct > package versions. > > How do I define this dependency in foreman?


Dominic Cleal
Red Hat Engineering

We use something like

Yumrepo<| |> -> Package<| |>

in our base class. You can only use this if you do not use @yumrepo
and @package with realize() though, or you are in for a world of pain.
But other than that, its very effective to ensure repositories are
always created before packages.

Cheers

··· On 04/18/2013 02:39 PM, Dominic Cleal wrote: > On 18/04/13 13:34, Dennis Jacobfeuerborn wrote: >> Hi, I'm currently setting up openstack using foreman and puppet >> and I've run into a problem that I do not know how to solve. >> >> The issue is that I assigned the class openstack::controller to >> the node with a bunch of parameters but before that I need to >> install a repo first (Red Hat RDO) so that openstack::controller >> installs the correct package versions. >> >> How do I define this dependency in foreman? > > You're not able to from Foreman as it can't express the dependency > through Puppet's ENC interface. The usual solution is to introduce > a third class, which you might call a role or profile class, and > then include this from Foreman instead. > > You could either have the new class include the other two directly, > and then only include role::openstack from Foreman: > > class role::openstack { class { 'repos::rdo': } -> class { > 'openstack::controller': } } > > Or if the classes are already included by Foreman or another > mechanism, you can just reference them: > > Class['repos::rdo'] -> Class['openstack::controller'] > > (This line could actually be placed anywhere relevant.) > > Regards, >

Hm, while this looks interesting in theory it doesn't seem to be of
practical use unless you write all classes/modules yourself from scratch
because if you use puppetforge or other repositories you have no control
over whether they use @package or not.

I'm really wondering if Foreman as an ENC for Puppet is really a good
approach as it seems to make things much more painful compared to using a
traditional site.pp.

Regards,
Dennis

··· On Thursday, April 18, 2013 8:32:02 PM UTC+2, vStone wrote: > > We use something like > > Yumrepo<| |> -> Package<| |> > > in our base class. You can only use this if you do not use @yumrepo > and @package with realize() though, or you are in for a world of pain. > But other than that, its very effective to ensure repositories are > always created before packages. > > Cheers > > > On 04/18/2013 02:39 PM, Dominic Cleal wrote: > > On 18/04/13 13:34, Dennis Jacobfeuerborn wrote: > >> Hi, I'm currently setting up openstack using foreman and puppet > >> and I've run into a problem that I do not know how to solve. > >> > >> The issue is that I assigned the class openstack::controller to > >> the node with a bunch of parameters but before that I need to > >> install a repo first (Red Hat RDO) so that openstack::controller > >> installs the correct package versions. > >> > >> How do I define this dependency in foreman? > > > > You're not able to from Foreman as it can't express the dependency > > through Puppet's ENC interface. The usual solution is to introduce > > a third class, which you might call a role or profile class, and > > then include this from Foreman instead. > > > > You could either have the new class include the other two directly, > > and then only include role::openstack from Foreman: > > > > class role::openstack { class { 'repos::rdo': } -> class { > > 'openstack::controller': } } > > > > Or if the classes are already included by Foreman or another > > mechanism, you can just reference them: > > > > Class['repos::rdo'] -> Class['openstack::controller'] > > > > (This line could actually be placed anywhere relevant.) > > > > Regards, > > > >