Chris Blumentritt wrote: > > > On Mon, Sep 21, 2009 at 10:03 AM, David Schmitt <da...@dasz.at > <mailto:da...@dasz.at>> wrote: > > > Chris Blumentritt wrote: > > node web1{ > > $secondary_ip = xxx > > > > network::ip { $secondary_ip: } > > apache::site { blah: ip => $secondary_ip } > > } > > > > > > How can I access the $secondary_ip variable from a class? I have the > > app_server class make the same site on more than one server and I > do not > > think I can more than once in the node. Besides, defining the > same site > > more than one time seems bad. > > > The variables propagate through the included classes. That way you can > use $secodary_ip everywhere. > > > I thought that would be the case but it does not seem to be working. I > dropped some notices to print the ip address in the log of the puppet > master and it is not printing anything. I had to take it a step further > where I set another variable = to the secondary ip address so that I > could use the same erb file for multiple projects. So I have it looking > like this > > node "app1" { > $secondary_ip = "x.x.x.x" > } > > class my_project::project_env { > create_project { $project_fqdn: > name => $project_name, > project_network_interface => $secondary_ip > } > } > > snip from erb: > > <VirtualHost <%= project_network_interface -%>:80> > > My apache conf ends up with this: > > <VirtualHost :80>
Looks very good, but you also need to include my_project::project_env after defining the secondary_ip in the node. Regards, DavidS --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---