Brian Ferris
2009-Oct-30 06:10 UTC
[Puppet Users] Tomcat Virtual-Host Entries - Dynamically Generating an Array with No Repeats from Different Classes
I''m using Puppet to manage my Tomcat configuration, including my server.xml file and a potentially shifting set of war files depending on the node. I''m also using Tomcat''s virtual-host capability, which involves adding a <Host/> element in the server.xml file for each virtual-host I wish to activate. The tricky bit is that each webapp/war has a different, possibly overlapping, virtual-host. Since I''d rather not list EVERY potential virtual-host in the server.xml file, I''d like some way of collecting the set of activated virtual-host names and then generating my server.xml file with the appropriate entries. I''m not sure how to do this. One idea is to have a master variable of virtual-host names: something like $Tomcat::hosts. I could use Puppet''s variable appending feature to extend the set of hosts: $Tomcat::hosts += [''some.host.name''] The only issue with this is that it could lead to duplicate entries if two webapps have the same virtual-host (a possibility). Is this maybe the purpose of virtual resources? How might I go about using them here? I don''t really have any good ideas on this, so any help is appreciated. Thanks, Brian --~--~---------~--~----~------------~-------~--~----~ 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Dan Bode
2009-Nov-04 20:37 UTC
[Puppet Users] Re: Tomcat Virtual-Host Entries - Dynamically Generating an Array with No Repeats from Different Classes
Hi Brian, you are definitely on the right track with virtual resources. Here is what I recommend. 1. Create virtual resources that specify all of the possibly virtual host entries as files 2. use realize to specify which file snippets should be used by which classes. 3. In the tomcat module, have an exec resource that appends all of the file snippets together in whatever order is required for server.xml. 4. The file snippets should notify the tomcat concat exec when one of them changes. Here is example code from volcane that demonstrates how you can manage these file snippets. http://nephilim.ml.org/~rip/puppet/concatfile/concat_file.pp Hope this helps, Dan --~--~---------~--~----~------------~-------~--~----~ 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---