Ask Your Question

puppet module hierarchy

asked 2015-04-27 12:35:08 -0500

jacktravine gravatar image

Trying to understand how to ensure specific modules are run in a specific priority. I have a bootup module that has various manifests being called along with the ntp module being called. What is the best way to ensure first the bootup::yum is run first then the resolv and finally ntp. Should I use stages and just separate everything out as laid out within this link (link text)? Or is there another method or process I am missing?

Example manifest.

class bootup {
include bootup::yum
include bootup::resolv
include ntp
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-04-27 15:14:42 -0500

JohnsonEarls gravatar image

updated 2015-04-27 18:39:28 -0500

Please see the Language: Relationships and Ordering and Language: Containment of Resources pages of the Puppet reference documentation.

To get the ordering: Use chaining arrows (->, ~>) to specify relationships:

Class['bootup::yum'] -> Class['bootup:resolv'] -> Class['ntp']

Because you're doing these includes inside of a class definition, you also need to ensure that the included classes are contained within the declaring class. If you're using Puppet 3.5 or greater, use the "contain" function instead of the "include" function to ensure the included classes are contained within the declaring class:

class bootup {
    contain bootup::yum
    contain bootup::resolv
    contain ntp
    Class['bootup::yum'] -> Class['bootup::resolv'] -> Class['ntp']

Before 3.5, you need to use the anchor resource type defined in the puppetlabs-stdlib module:

class bootup {
    include bootup::yum
    include bootup::resolv
    include ntp
    anchor { 'bootup::start': } -> Class['bootup::yum'] -> Class['bootup::resolv'] -> Class['ntp'] -> anchor { 'bootup::end': }
edit flag offensive delete link more


I am running 3.3.2. I appreciate you providing a back-ported solution. The contain function gives me more reason to upgrade to 3.4.x.

jacktravine gravatar imagejacktravine ( 2015-04-28 07:25:11 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-04-27 12:30:08 -0500

Seen: 174 times

Last updated: Apr 27 '15