Ask Your Question

dependencies between classes

asked 2013-12-03 16:04:48 -0600

rakkaus gravatar image

updated 2013-12-03 16:42:51 -0600

So can some one explain me such behaviour:

I have a service that require some modules that consists of few classes

node "" {
  include third_party::mongo::install
  include my-super-service-install

  service { "my-super-service":
    ensure     => running,
    enable     => true,
    hasstatus  => true,
    hasrestart => true,
    require    =>   Class["third_party::mongo::install"],

for example

class third_party::mongo::install {
  include third_party::mongo::repo
  include third_party::mongo::package
  class { "third_party::mongo::config":
   superAdminPwd => $mongoAdminPass,
   userPwd       => $mongoUserPass
  include third_party::mongo::service

Does it mean that my-super-service will be launched only after all included classes will be executed in third_party::mongo::install ?

In fact I've got something like this:

  • created ...
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-12-03 17:30:34 -0600

rakkaus gravatar image

updated 2013-12-03 17:31:56 -0600

I've solved this by changing require in my service from third_party::mongo::install class to third_party::mongo::service That's give me what I want but I still belive that it's not a good way... and I still looking for best practices on this.

edit flag offensive delete link more

answered 2013-12-04 12:37:11 -0600

lavaman gravatar image

Requiring other classes (especially classes from the same module) is quite common. Your use case is perhaps the most common example of this being done. You aren't doing anything outside the norm.

edit flag offensive delete link more


nonono my question is how to contorol order on `node` level and I mean that using require in my service for other package is not good, I want to create ...(more)

rakkaus gravatar imagerakkaus ( 2013-12-04 14:04:30 -0600 )edit

The way alot of people order the use of separate modules is using roles and profiles: It's not a good idea to ...(more)

lavaman gravatar imagelavaman ( 2013-12-04 14:27:10 -0600 )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


Asked: 2013-12-03 16:04:48 -0600

Seen: 608 times

Last updated: Dec 04 '13