On Saturday, March 29, 2014 8:48:26 AM UTC-5, Vishwa Kumba wrote:
>
> I was wondering if there is a way to define ordering between 2 
> create_resources in puppet manifests.
>
> For example:
>
> create_resources('php::install', $php_packages)  ->
> create_resources('webapps::deploy', $apps)
>
> The above does not work, but does puppet support the ordering between 2 
> create_sources statements?
>


Yes and no.  Puppet evaluates those statements in the order they appear in 
the manifest file, so in that sense you don't need special ordering 
operators.  But that's part of catalog *compilation*.  What you really are 
after is to influence the relative order of *application* of the resources 
declared via the two create_resources() calls.

 

> I need my webapps to be deployed after the required packages have been 
> installed.
>
> I have seen a syntax like this below. Here class['apache'] seems to be 
> execued before the create_resources here.
>
> include apache
> Class['apache'] -> Webapps::Deploy_files <| |>
> create_resources('webapps::deploy_files', $apps)
>
> Is there any puppet documentation on this strange syntax <| |>?
>


Yes: http://docs.puppetlabs.com/puppet/3/reference/lang_collectors.html.  
See also 
http://docs.puppetlabs.com/puppet/3/reference/lang_virtual.html#realizing-with-a-collector
.

I would recommend you read through the entire DSL reference, though, not 
just random bits.

 

> Using this syntax, is it possible to call create_resources before and 
> after a class declaration?
>
>

A create_resources() call can appear almost anywhere in any of your 
manifests, though there are many places in which it is probably not 
useful.  Again, however, the issue is not with the create_resources() call 
itself, but rather with the resources declared via that mechanism.  Denmat 
has offered you one possible solution, which has the advantage of not 
requiring any modification to the resources being declared (provided that 
their data did not already specify any tag).  Another alternative might be 
to modify the webapps::deploy_files definition to declare the dependency 
directly, such as via a "require 'apache'" statement.


John

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/83f0f8b2-eaab-484f-98ad-e6551c9aaf4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to