Puppet Contain

398 views
Skip to first unread message

Anfield

unread,
Oct 31, 2016, 12:12:49 PM10/31/16
to Puppet Users
Can anyone explain what puppet contain function does for classes? Cant seem to grasp this concept.

Thanks in advance

Martin Alfke

unread,
Nov 1, 2016, 3:25:00 AM11/1/16
to puppet...@googlegroups.com
Hi Gareth,
> On 31 Oct 2016, at 17:10, Anfield <gareth...@gmail.com> wrote:
>
> Can anyone explain what puppet contain function does for classes? Cant seem to grasp this concept.

contain adds a class to the catalog (similar to what include does).
But contain handles the way where the class gets added.

Think about the following code:

class a {
include c
}
class b {
include c
}

node default {
include a
include b
Class[‘a’] -> Class[‘b’]
}

When does class c gets added to the catalog?
Class a and b are put into order. But class c is not added at a specific place in the catalog.

This is where contain comes into place:

class a {
contain c
}
class b {
include c
}

node default {
include a
include b
Class[‘a’] -> Class[‘b’]
}

In this case the contain function ensures that the class c is added within class a.

hth,
Martin

Chuck

unread,
Nov 1, 2016, 7:24:06 PM11/1/16
to Puppet Users
This is a really good video that explains it.

http://youtu.be/jvDLXykcxiA

Reply all
Reply to author
Forward
0 new messages