On 25/08/16 22:40, Albert Shih wrote:
Hi,

I would like to known how can I use a class in different place. Let's take
a example.

I have a module who manage a CMS, let's say something like drupal (or
whatever you want). So in this CMS I need to use apache class. So I get in
my

  node.yaml

something like

  classes :
    - my_drupal_class

  my_drupal_class::options::config1:
  my_drupal_class::options::config2:
  ...
  my_drupal_class::options::confign:


So now lets say I need a very simple vhost on that host. How can I do that
? If I load the class { apache } puppet going to complain because it's
already loaded inside my_drupal_class. If I don't load the class { apache }
I'm going to loose most of the params.pp (Like the version, the logpath
etc..)

Regards.


The recommended approach is to always use 'include()' to include the classes (you can include the same class any number of times). You then use data binding (that is, automatic binding of class parameters to values) by storing the parameters in hiera.

This way, all use of a class will get exactly the same parameter values
and the things being managed are only managed once. (As you noted you cannot manage the same thing more than once using the resource like way of creating a class where you can give it its parameter values even if you were to give it exactly the same values).

Hope that helps.

- henrik

JAS



--
Albert SHIH
DIO bātiment 15
Observatoire de Paris
5 Place Jules Janssen
92195 Meudon Cedex
France
Téléphone : +33 1 45 07 76 26/+33 6 86 69 95 71
xmpp: [email protected]
Heure local/Local time:
jeu 25 aoū 2016 22:35:41 CEST



--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
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/9bc8c891-c9ee-722a-80f7-a97ce2adc677%40puppet.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to