I working on configuring CQ5 on vagrant managed virtual machine. The provisioning is done using puppet. I have query regards to the order of execution of classes/resources in puppet manifest file.

Please find below manifest file cqsite.pp

include java
include apache
cq::instance {myauthor:
      installation_type => author,

cq::instance {mypublish:
      installation_type => publish,

During provision puppet is initially picking cq resources (cq::instance ) rather than java. But java must be installed first to execute few commands in cq::instance.pp file. So its throwing an error. Please help me in finding solution for this


You're not specifying any resource dependencies so Puppet will apply the changes in a seemingly random order.

If the java class should be installed before your cq::instance definitions, then you should add an explicit dependency like so:

cq::instance { myauthor:
  installation_type => author,
  require           => Class['java']

Or even:

Class['java'] -> Cq::Instance <| |>

See https://docs.puppetlabs.com/puppet/latest/reference/lang_relationships.html

  • 1
    Puppet will apply the changes in a seemingly random order. - Of course if you have new enough version of puppet you can use ordering = manifest. Explicitly stating relationships, like you suggested, is strongly prefered to make your manifests more readable. – Zoredache Dec 17 '14 at 17:54
  • 1
    Yes, I'm aware of manifest ordering and that these days the order isn't truly random however I'm reluctant to state manifest ordering as a solution as I feel it reinforces a misunderstanding of Puppet as a scripting language. Also, a module should not have to dictate this global setting because the module author doesn't explicitly state relationships between resources. – bodgit Dec 18 '14 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.