I generally don't use includes. I do class declarations. If you need to 
order classes within a module I tend to use the before or require and 
subscribe for ordering. So for instance for module foo if I need class 
first to run first and two to run second I could do either of the 
following. 

class foo {
  class {'first':
    before => Class['two']
  }
  class {'two':}
}

Or 
class foo {
  class {'first':  }
  class {'two':
    require => Class['first']
  }  
}

Require is good if you had say a config class that requires a package be 
installed first. If you need a module to run before a second module I'll 
typically chaining (and note you could just as easily do this inside your 
init file for class ordering within a module)

class runafter {
  Class['runbefore'] -> Class['runafter']
  class {'foo': }
  class {'bar': }
}

In this case module runbefore will be run before module runafter. Note that 
this assumes that you declare these modules to the node as class 
declarations (ie node foo { class {'runbefore': } }. Also note that now 
runafter depends upon runbefore. IOW if you fail to declare runbefore then 
your catalog will fail to compile if you use runafter. And the first 
example declared with this latter method would look like this. 

class foo {
  Class['first']->Class['two']
  class {'first':  }
  class {'two': }
}

Again I don't use the includes so I don't know how that changes the 
equation, but you can do most, if not all, of your ordering with either of 
these two methods. For more information check out this link 
<https://docs.puppetlabs.com/learning/ordering.html>.  And just to throw it 
out there if you have a module that needs to be run before all other 
modules (like a yum module or apt module) you can set run stages 
<https://docs.puppetlabs.com/puppet/latest/reference/lang_run_stages.html>, 
but avoid this for all but the broadest of cases like the ones already 
mentioned. 

On Tuesday, December 9, 2014 12:06:14 PM UTC-5, lupin...@gmail.com wrote:
>
> Hi,
>
> The initial error was a typo, but the Order of execution of class is not 
> being achieve, is this possible?
>
> Cheers
>
> On Tuesday, December 9, 2014 9:22:35 PM UTC+13, lupin...@gmail.com wrote:
>>
>>
>> Hi,
>>
>>  I'm struggling with Ordering/Relationship between modules classes, I 
>> used this as my guide http://puppetlabs.com/blog/class-containment-puppet 
>> but somehow still can't make it work correctly.
>>
>> So I have
>>
>> tail  ../../role/manifests/lbserver.pp 
>> class role::lbserver {
>>
>>   include profile::model
>>   include profile::data
>>   include profile::modadp
>>   Class['::profile::model'   ] ->
>>   Class['::profile::data'] ->
>>   Class['::profile::modadp']
>> }
>>
>>
>> root@puppet-m:/etc/puppetlabs/puppet/environments/development/modules/profile/manifests#
>>  
>> cat model.pp 
>> class profile::model {
>>   contain '::spss_model' 
>> }
>> root@puppet-m:/etc/puppetlabs/puppet/environments/development/modules/profile/manifests#
>>  
>> cat data.pp 
>> class profile::data {
>>   contain '::mod_data'
>> }
>> root@puppet-m:/etc/puppetlabs/puppet/environments/development/modules/profile/manifests#
>>  
>> cat model.pp 
>> class profile::model {
>>   contain '::mod_model' 
>> }
>> root@puppet-m:/etc/puppetlabs/puppet/environments/development/modules/profile/manifests#
>>  
>> cat modadp.pp 
>> class profile::modadp {
>>   contain '::mod_modadp'
>> }
>> I received the following error.
>>
>> Error: Could not retrieve catalog from remote server: Error 400 on 
>> SERVER: Could not find class ::mod_modadp for node x.x.x.x
>>
>> Thanks in advance.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/4079fac5-865b-4bd4-87ad-1117d40724da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to