----- Original Message -----
> From: "Yaniv Fine" <yanivf...@gmail.com>
> To: puppet-users@googlegroups.com
> Sent: Wednesday, July 18, 2012 10:03:01 AM
> Subject: Re: [Puppet Users] Re: Out-of-Scope Variables
> 
> 
> Frank .
> let me put it all together :)
> 
> i have a module name "sharevar"
> i have another module "newmodule"
> inside "sharevar"/manifest/genreic.pp
> class sharevar::generec {
> $vartest = 'infooramtion'
> }
> 
> i have newmodule/manifest/men.pp
> that include the content => template path erb file
> and i have the newmodule/templates/new.erb file
> that i want to use value from ("sharevar"/manifest/genreic.pp)
> the $vartest value
> 
> hope this helps
> 
> thank you for your effort .

class sharevar {
   $vartest = "info"
}

class newmodule {
   # you have to include sharevar somewhere, can be in a node or anywhere else
   include sharevar

   # access the variable in another module in a .pp file
   notify{"vartest is ${sharevar::vartest}": }

   # access it in a template
   file{"/tmp/test": content => template("new.erb")}
}


new.erb:

<%= scope.lookupvar("sharevar::vartest") %>

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

Reply via email to