Re: [Puppet Users] Globally used parameter

2014-09-22 Thread jcbollinger


On Friday, September 19, 2014 2:25:34 PM UTC-5, Jose Luis Ledesma wrote:

 Using hiera is probably the best solution.


So that would mean creating 'server' as an hiera item, and having each 
class that wanted it look it up as

$server = hiera('server')

That's basically the property file approach.  An alternative would be to 
choose one class to be the owner of the data, and have all the other 
classes involved use that.  The chosen class could be one of the existing 
ones, or it could be a separate one, possibly in a different module:

class settings::network {
  $port = 1234
}

class server::config {
  $listen_port = $::settings::network::port
}

Do understand, however, that cross-module variable references are 
considered poor form by many, as they undermine modularity.  Inter-class 
variable references are better limited to classes in the same module.


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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/6b5f7df1-57b0-4e34-83c2-536c86e9889e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Globally used parameter

2014-09-19 Thread Marco Dürrwächter
Hi,

I'm searching for the best way to use parameter in multiple modules. 

Example: I am declaring a variable $port in module 'server' and I need this 
variable in module 'firewall' to open this port. If i have to change this 
variable I actually have to change 4 Variables in 4 modules. 

Is there a way to load variables from a property file, or an extra 
'settings' module?
What would be the best solution?

Greets,
Marco

-- 
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/e38822b8-bd6a-4156-800f-ac9592f8b950%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Globally used parameter

2014-09-19 Thread José Luis Ledesma
Using hiera is probably the best solution.

Regards,
El 19/09/2014 14:14, Marco Dürrwächter derse...@gmail.com escribió:

 Hi,

 I'm searching for the best way to use parameter in multiple modules.

 Example: I am declaring a variable $port in module 'server' and I need
 this variable in module 'firewall' to open this port. If i have to change
 this variable I actually have to change 4 Variables in 4 modules.

 Is there a way to load variables from a property file, or an extra
 'settings' module?
 What would be the best solution?

 Greets,
 Marco

 --
 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/e38822b8-bd6a-4156-800f-ac9592f8b950%40googlegroups.com
 https://groups.google.com/d/msgid/puppet-users/e38822b8-bd6a-4156-800f-ac9592f8b950%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.


-- 
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/CAF_B3de1H3KAithH-od3LK1QKJ2BCYTXXfQxx%3DfDU9Xw2Tokqg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.