Re: [Puppet Users] Re: defined types and enc

erkan yanar
Fri, 26 Oct 2012 20:52:53 -0000

On Fri, Oct 26, 2012 at 12:24:52PM -0700, jcbollinger
wrote:
>
[snip]
>
>
> > If not is there a trick to call a class many times for a node. (Maybe
by
> > manipulating the name?)
> >
> >
> You can create classes with different names but similar content, or you can
> use one class that wraps all the resources you want.  For example,
>
> class mymodule::lxc_application_containers {
>   mymodule::lxc_application_container { ''container1:
>     application => ''Awesomeness1.1''
>     # other parameters
>   }
>   mymodule::lxc_application_container { ''container2:
>     application => ''Moneymaker3.2''
>     # other parameters
>   }
>   # other containers ...
> }

Ok my defined types in a class.
How would that look like in a yaml-output?

>
> Supposing that the point is to select a subset of the available
> applications for each target node, using the one-class approach, you can do
> that via global variables (yuck), class parameters (meh), or data from an
> external source (best bet).

Hmm, right now it is the same application running multiple times.


>
> On the other hand, don''t discard the idea of different classes too
> lightly.  In many cases it makes a lot of sense.  In particular, it may
> relieve pressure on your defined type to be sufficiently flexible to do
> everything needed for any application you might ever want to use.  Having a
> separate class for each module could make it a lot easier to deal with the
> special needs of each application.
>

Right, in my case it is (for now) the same application. Having for every
application
a different name would no be that dynamic I would suggest/hope it to be.
As the differ in IP and some dirs only.
So this would suggest to write a class for every application I want to run then?


[snip/thx]

Regards