> This is the biggest mistake I see amongst people new to Puppet. A
> definition isn't "called." A definition is not a function. Puppet is a
> declarative language, not an imperative language. You need to make
> this conceptual jump to understand the Puppet way of doing things.
>
> Conceptually, a definition IS a resource. Let me repeat that:
>
> Definition == Resource
>
> That is why the syntax is the same. Definitions provide you the
> ability to create composite resources that abstract away the details
> of the individual resource "atoms" (file, service, etc.) that are
> required to make up your defined resource.
>
> Calling a definition absolutely should *NOT* be equivalent to
> including a class, they are very different collections. Definitions
> are used to abstract away collections of resources while maintaining
> the ability to have multiple "instances" of the defined resource. So,
> you can have multiple subversion::working-copy instances within a
> single class of machine, this is a critical capability to have!
> Classes are collections used to wholly define a role that a certain
> node plays. So, while it may take multiple subversion::working-copy
> instances to make up a webserver, you don't want multiple "webserver"
> roles on a single node, that's conceptually weird.
>
> --Paul

ok paul, thanks for clarifying this.

I think my misconception comes from what we're trying to do.

We have webapps that have instances defined for different set of
countries
So we have definitions like :
   define webapp-instance($countries, ...)

And then for a set of machines we want to deploy our instances, but no
machine has the exact same requirement :
node node1 {
    webapp-instance { "es_fr", countries = ["es", "fr"] }
    webapp-instance { "uk", countries = ["uk"] }
}
node node2 {
    webapp-instance { "es_it", countries = ["es", "it"] }
    webapp-instance { "de", countries = ["de"] }
}
and so on...

So, if I follow your guidelines, I should define intermediate classes
and then use theses classes in the nodes
class webapp_instance_es_fr {
   webapp-instance { "es_fr", countries = ["es", "fr"] }
}

class webapp_instance_uk {
   webapp-instance { "uk", countries = ["uk"] }
}

class webapp_instance_"de" {
   webapp-instance { "de", countries = ["de"] }
}

and then put theses classes in my nodes :
node node1 {
   include webapp_instance_es_fr
   include webapp_instance_uk
}

Although this step makes sense, it happens that using "definition
call" (how should I say ?) directly in nodes is easier because people
in charge of managing nodes don't have to write intermediate classes
that only act as wrapper.
As there is almost no machine with the same country configuration
(that is, a class will only be used by one machine in practice), the
overhead of writing intermediate classes gives no real benefits, even
if conceptually cleaner.

Any comment on this ?

thanks

nicolas


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to