Thursday, September 25, 2014

Puppet - Containment

INCLUDE  !=  CONTAINMENT

Containment of CLASSES and RESOURCES are treated differently.

Classes never contain the classes they include

Classes contain the resources they declare.
Defined type instances contain the resources they declare.

The purpose of containment, in general, is to let you control where and when certain parts of your Puppet code are executed.

The anchor pattern is a MUST for all modules which may be used with Puppet 2.6.x or Puppet Enterprise 1.x.    A module author SHOULD contain the declared classes by declaring a begin and an end anchor, then relating the declared classes to these anchors.

Paraphrasing Again:
A class contains all of its resources. This means any relationships formed with the class as a whole will be extended to every resource in the class.
Classes can also contain other classes, but you must manually specify that a class should be contained.
Then there is another thing called require that I am not talking about.
Also not talking about contain which is relatively new.

http://blog.mayflower.de/4573-The-Puppet-Anchor-Pattern-in-Practice.html
http://puppetlabs.com/blog/class-containment-puppet
http://projects.puppetlabs.com/projects/puppet/wiki/Anchor_Pattern


https://docs.puppetlabs.com/puppet/latest/reference/lang_containment.html

No comments:

Post a Comment