Hi All, I''m in the process of creating Puppet modules for my load balanced environment. I have multiple Apache nodes behind a load balancer and each Apache virtual host has its own internal IP. I''ve created an Apache module that does this by creating an Apache vhost template and define my own variables that are substituted by variables I''ve defined in my nodes configuration. E.g. apache1 node.pp: $ip_www = 10.0.0.1 $ip_www2 10.0.0.1 apache2 node.pp: $ip_www = 10.0.0.1 $ip_www2 10.0.0.1 apache vhost template: <VirtualHost <%= ip_www %>:80> The next step is to configure Piranha using Puppet. The module creates a template using the IP''s defined in my node configuration. In order to use the IP''s I''ve defined in the nodes config file for the piranha configuration I''d need to rename the variables to something like: $apache1_ip_www = 10.0.0.2 $apache1_ip_www2 10.0.0.2 As you can see if change the variable names to reflect the node name then the Apache vhost template will not be generated correctly. My question is what is the "best practise" when doing something like this? I was thinking of creating a new file for each apache node and write an "if" statement to include the appropriate file. Another option would be to put a case statement in the Apache module that if, for example, the nodes name is apache2 then set $ip_www as $apache1_ip_www. The part that I''m "concerned about" is how to redefine variables to make them compatible with both modules and perhaps future modules. I hope this all makes sense. Thanks, Gareth -- 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.
> The next step is to configure Piranha using Puppet. The module creates > a template using the IP''s defined in my node configuration. In order to > use the IP''s I''ve defined in the nodes config file for the piranha > configuration I''d need to rename the variables to something like: > > $apache1_ip_www = 10.0.0.2 > $apache1_ip_www2 10.0.0.2 > > As you can see if change the variable names to reflect the node name > then the Apache vhost template will not be generated correctly. > > My question is what is the "best practise" when doing something like > this? I was thinking of creating a new file for each apache node and > write an "if" statement to include the appropriate file. Another option > would be to put a case statement in the Apache module that if, for > example, the nodes name is apache2 then set $ip_www as $apache1_ip_www. > The part that I''m "concerned about" is how to redefine variables to make > them compatible with both modules and perhaps future modules. I hope > this all makes sense.Not really ;-) Do I read this correctly? You have two templates that are not generally related, but rely on the same basic facts (i.e., a per-node IP-address dedicated to Apache instances)? What I''d do is (very near the definition of your "new" template) $apache1_ip_www = $ip_www $apache1_ip_www2 = $ip_www2 By the way, have you checked whether the $ipaddress fact produces the correct address for you? Because it would be several orders of magnitude cleaner, more readable and more maintainable than inventing your custom variables. You may even want to add a custom fact instead, if 10.0.0.2 is in fact not the primary address of your node. HTH, Felix -- 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.
Possibly Parallel Threads
- Implementing LVS changes made in Piranha GUI
- SECURITY: UPDATED - RHSA-2000:014 New Piranha release available
- SECURITY: [RHSA-2000:014-10] Updated piranha packages available
- Unrecognized character \xED at perl-Date-Calc-5.4-1.2.2.1.i386.rpm line 1
- Re: IPMASQ and lock-up of all terminals ---- Sum mary and update