[Puppet Users] Best practice to share variable values among nodes

2013-01-30 Thread Sylvain Mougenot
Hello, I'm new to puppet using a puppet-master. And I couldn't figure out 
what's the best practice I need.

*My context : *
- puppet-master with a puppet dashboard is setup and running
- few modules are ready and fully fonctionnal (tested using vagrant and 
puppet apply)
- there are some nodes in different zone (such as dev, QA, preprod, prod, 
...)

In fact, 
I've some shared resources in a zone :
- SQL data-base
- Mail server
- ...
And my apps are running in several nodes (for the same zone) :
- one node as the front-end role
- another as the back-office role
- 
So I'd like to setup the configuration variables in one place (by zone) and 
reuse it among nodes in the same zone.
(Obviously, every node as some specific configurations)

*My question is :*
- How can I share some variable svalues among nodes (like those in the same 
zone for exemple)?

*What to do ?*
- I tryed to put the zone specific variables in a dedicated configuration 
file andimport it in the relevant nodes. But this didn't worked telling me 
that I redefined variable (as soon as I've several zones)
- Should I create a template node by zone with thoses common varaibles?
- Is there any other way to do?

*
*
*Sample files are below:*

Sample class :
class p2es::plateforme_stockage(
$env  ='integration',
$yumrepo_host ='10.10.25.5',
$version  =undef,
$ensure   =undef,
$rwpwd=admin,
$ropwd=reader,
$probepwd =probe,
$bddhost  =10.10.25.23,
$bddlogin =l_ps,
$bddpwd   =l_ps,
$mailhost =smtp.XXX.fr,
$mailto   =dev-p...@xxx.fr,
$mailfrom =dev-p...@xxx.fr){

# Repo YUM
class{ p2es::repo:
  env  = $env,
  yumrepo_host = $yumrepo_host
}


Sample node :
node /^.*ps.*preprod.*$/ inherits base {

# Partie de la conf mutualisée
import '../configuration/p2es_ps_conf_preprod'

# indiquer l'environnement cible
$env= 'preprod'

# Le soft
class{ p2es::plateforme_stockage:
env   = $env,
yumrepo_host  = $YUM_REPO_HOST,
version   = $PS_VERSION,
ropwd   = $JMX_RO_PWD,
rwpwd   = $JMX_RW_PWD,
probepwd= $PSI_PROBE_PWD,
bddhost = $BDD_HOST,
bddlogin= $BDD_LOGIN,
bddpwd  = $BDD_PWD,
mailhost= $MAIL_HOST,
mailto  = $MAIL_TO,
mailfrom= $MAIL_FROM
}
}

Sample configuration :
$YUM_REPO_HOST=10.10.25.5
$DATASRC_HOST=10.10.25.23
$DATASRC_LOGIN=l_pe
$DATASRC_PASSWORD=l_pe
$MONGODB_HOST=10.10.25.23
$MONGODB_LOGIN=
$MONGODB_PASSWORD=
$PS_HOST=10.10.25.39
$PS_LOGIN=admin
$PS_PASSWORD=adminspassword
$CAS_VALIDATE_URL=
$CAS_LOGIN_URL=adminspassword
$CAS_LOGOUT_URL=adminspassword
$SECURITY_WS_URL=
...

Thank you for your help

-- 
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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] Best practice to share variable values among nodes

2013-01-30 Thread Wolf Noble
On Jan 30, 2013, at 4:52 AM, Sylvain Mougenot sylvain.mouge...@gmail.com
 wrote:

 Hello, I'm new to puppet using a puppet-master. And I couldn't figure out 
 what's the best practice I need.

 My context :
 - puppet-master with a puppet dashboard is setup and running
 - few modules are ready and fully fonctionnal (tested using vagrant and 
 puppet apply)
 - there are some nodes in different zone (such as dev, QA, preprod, prod, 
 ...)

 In fact,
 I've some shared resources in a zone :
 - SQL data-base
 - Mail server
 - ...
 And my apps are running in several nodes (for the same zone) :
 - one node as the front-end role
 - another as the back-office role
 - 
 So I'd like to setup the configuration variables in one place (by zone) and 
 reuse it among nodes in the same zone.
 (Obviously, every node as some specific configurations)

 My question is :
 - How can I share some variable svalues among nodes (like those in the same 
 zone for exemple)?

 What to do ?
 - I tryed to put the zone specific variables in a dedicated configuration 
 file andimport it in the relevant nodes. But this didn't worked telling me 
 that I redefined variable (as soon as I've several zones)
 - Should I create a template node by zone with thoses common varaibles?
 - Is there any other way to do?


 Sample files are below:

 Sample class :
 class p2es::plateforme_stockage(
 $env  ='integration',
 $yumrepo_host ='10.10.25.5',
 $version  =undef,
 $ensure   =undef,
 $rwpwd=admin,
 $ropwd=reader,
 $probepwd =probe,
 $bddhost  =10.10.25.23,
 $bddlogin =l_ps,
 $bddpwd   =l_ps,
 $mailhost =smtp.XXX.fr,
 $mailto   =dev-p...@xxx.fr,
 $mailfrom =dev-p...@xxx.fr){

 # Repo YUM
 class{ p2es::repo:
   env  = $env,
   yumrepo_host = $yumrepo_host
 }
 

 Sample node :
 node /^.*ps.*preprod.*$/ inherits base {

   # Partie de la conf mutualisée
   import '../configuration/p2es_ps_conf_preprod'

   # indiquer l'environnement cible
 $env= 'preprod'

 # Le soft
 class{ p2es::plateforme_stockage:
 env   = $env,
 yumrepo_host  = $YUM_REPO_HOST,
 version   = $PS_VERSION,
 ropwd   = $JMX_RO_PWD,
 rwpwd   = $JMX_RW_PWD,
 probepwd= $PSI_PROBE_PWD,
 bddhost = $BDD_HOST,
 bddlogin= $BDD_LOGIN,
 bddpwd  = $BDD_PWD,
 mailhost= $MAIL_HOST,
 mailto  = $MAIL_TO,
 mailfrom= $MAIL_FROM
 }
 }

 Sample configuration :
   $YUM_REPO_HOST=10.10.25.5
   $DATASRC_HOST=10.10.25.23
   $DATASRC_LOGIN=l_pe
   $DATASRC_PASSWORD=l_pe
   $MONGODB_HOST=10.10.25.23
   $MONGODB_LOGIN=
   $MONGODB_PASSWORD=
   $PS_HOST=10.10.25.39
   $PS_LOGIN=admin
   $PS_PASSWORD=adminspassword
   $CAS_VALIDATE_URL=
   $CAS_LOGIN_URL=adminspassword
   $CAS_LOGOUT_URL=adminspassword
   $SECURITY_WS_URL=
 ...

 Thank you for your help

Hi Sylvain,



Check out hiera. It contains loads of awesome, and should allow you to feed the 
nodes relevant variables for each zone.

http://projects.puppetlabs.com/projects/hiera
https://github.com/puppetlabs/hiera


HTH

W




This message may contain confidential or privileged information. If you are not 
the intended recipient, please advise us immediately and delete this message. 
See http://www.datapipe.com/legal/email_disclaimer/ for further information on 
confidentiality and the risks of non-secure electronic communication. If you 
cannot access these links, please notify us by reply message and we will send 
the contents to you.

-- 
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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.