Ask Your Question

add source::list before configuring puppetmaster

asked 2017-03-30 10:18:18 -0500

puppetdude gravatar image

Hi, I'm trying to configure puppetmaster with puppetdb+unicorn+nginx, so I created module "puppetmaster" where I declare classes from puppetforge modules to facilitate my work, like

  require puppetmaster::repo

  class {'puppetdb::globals': version = > $puppetdb_version}

  class {'puppetdb':
       #disable postgresql repo
       manage_package_repo => false, 
       postgres_version            => $postgres_version,

  class { 'puppetdb::master::config': }

  class {'nginx':
        manage_repo  => false,
        package_name => 'nginx-full',

  class {'java':
        package => $java_version,

  class { 'unicorn': }

but the problem is, when you use resource-like class declarations in your master class, ordering doesn't work at all, In my case postgresql::server class is avaluated first (it is declared in puppetdb module), then nginx, then java, then puppetdb package and at last apt::source that is declared in puppetmaster::repo class, how can I overcome this restriction, while keeping all code required to configure puppetmaster in a single module?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2017-03-31 07:37:39 -0500

DarylW gravatar image

From the docs

By default, Puppet applies resources in the order they’re declared in their manifest. However, if a group of resources must always be managed in a specific order, you should explicitly declare such relationships with relationship metaparameters, chaining arrows, and the require function.

You shouldn't rely on manifest ordering if you have strict ordering requirements. You should specify ordering using either the chaining syntax ->or with explicit relationship metaparameters... more information can be found at

I'm not sure which ordering you need strictly enforced, but if you let me know I can show you your example with the ordering added.

Once you have added resource ordering, you may still encounter things 'floating out' of the class ordering, where you will need to use containment appropriately... See some gotcha's listed at . Some more specific answers to the containment problem in an enclosing class (Usually encountered while using the 'roles and profiles' pattern, and trying to order profiles) are given in these posts:

edit flag offensive delete link more


After a lot of struggle and precise reading of debug output I've came out with followng solution: Class['::Puppetmaster::Repo'] -> Class['::Apt::Update'] -> Class['::Postgresql::Client', '::Postgresql::Server::Install', '::Puppetdb::Master::Config']

puppetdude gravatar imagepuppetdude ( 2017-03-31 09:18:57 -0500 )edit

it looks ugly, but as I said: 'when you use resource-like class declarations in your manifest, ordering doesn't work'

puppetdude gravatar imagepuppetdude ( 2017-03-31 09:20:04 -0500 )edit

It's not really that ugly, it's just explicit. Glad you found your solution!

DarylW gravatar imageDarylW ( 2017-03-31 09:33:41 -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: 2017-03-30 10:18:18 -0500

Seen: 32 times

Last updated: Mar 31