Hi All, In our environment, we have production and DR puppet clients that live on different networks. Currently, we do things like "include s_service::prod" or "include s_service::dr", etc. Both of these subclasses would inherit from s_service where common things lie. I am re-doing the Puppet config and trying to come up with a better way of solving the multiple environment problem. Sometimes files need to be sourced that depend on their environment. Currently we do "source => puppet:///${env}/file", which isn''t very nice. I have created 2 new facter variables that identify whether the host is prod or DR (based on the network they sit on), whereas before we would set the zone statically in nodes.pp. How do you guys solve the multiple environment problem? Is it best to use templates and have if statements in them? Thanks in advance. Gonzalo -- 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.
Daniel Maher
2011-Oct-12 08:02 UTC
Re: [Puppet Users] Different paths based on environment
On 10/11/2011 11:14 PM, Gonzalo Servat wrote:> I am re-doing the Puppet config and trying to come up with a better way > of solving the multiple environment problem. Sometimes files need to be > sourced that depend on their environment. Currently we do "source => > puppet:///${env}/file", which isn''t very nice.Just out of curiousity, what is it that you don''t like about your current solution ? -- Daniel Maher If the master dies and the disciple grieves, the lives of both have been wasted. -- 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.
Nigel Kersten
2011-Oct-12 15:25 UTC
Re: [Puppet Users] Different paths based on environment
On Tue, Oct 11, 2011 at 2:14 PM, Gonzalo Servat <gservat@gmail.com> wrote:> Hi All, > > In our environment, we have production and DR puppet clients that live on > different networks. Currently, we do things like "include s_service::prod" > or "include s_service::dr", etc. Both of these subclasses would inherit from > s_service where common things lie. > > I am re-doing the Puppet config and trying to come up with a better way of > solving the multiple environment problem. Sometimes files need to be sourced > that depend on their environment. Currently we do "source => > puppet:///${env}/file", which isn''t very nice. >Are you saying you''re sourcing files from outside the current environment for the client? if you put your files into modules that differ per environment, then something like: puppet:///modules/mymodule/myfile will resolve to $modulepath/mymodule/files/myfile separately for each environment automatically.> > I have created 2 new facter variables that identify whether the host is > prod or DR (based on the network they sit on), whereas before we would set > the zone statically in nodes.pp. > > How do you guys solve the multiple environment problem? Is it best to use > templates and have if statements in them? > > Thanks in advance. > Gonzalo > > -- > 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. >-- Nigel Kersten Product Manager, Puppet Labs -- 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.
Gonzalo Servat
2011-Oct-12 21:19 UTC
Re: [Puppet Users] Different paths based on environment
On Wed, Oct 12, 2011 at 7:02 PM, Daniel Maher <dmaher@plizy.com> wrote:> On 10/11/2011 11:14 PM, Gonzalo Servat wrote: > > I am re-doing the Puppet config and trying to come up with a better way >> of solving the multiple environment problem. Sometimes files need to be >> sourced that depend on their environment. Currently we do "source => >> puppet:///${env}/file", which isn''t very nice. >> > > Just out of curiousity, what is it that you don''t like about your current > solution ? >Mainly the fact that it won''t fallback to a default if it can''t find ${env}/file. I just learnt yesterday that you can specify multiple sources and Puppet will simply pick the first one found, so that''s good news. - Gonzalo -- 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.
Gonzalo Servat
2011-Oct-12 21:20 UTC
Re: [Puppet Users] Different paths based on environment
On Thu, Oct 13, 2011 at 2:25 AM, Nigel Kersten <nigel@puppetlabs.com> wrote:> > Are you saying you''re sourcing files from outside the current environment > for the client? > > if you put your files into modules that differ per environment, then > something like: > > puppet:///modules/mymodule/myfile > > will resolve to $modulepath/mymodule/files/myfile separately for each > environment automatically. >Ah, so then I would need to specify a different modulepath per environment, right? - Gonzalo -- 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.
Nigel Kersten
2011-Oct-12 21:38 UTC
Re: [Puppet Users] Different paths based on environment
On Wed, Oct 12, 2011 at 2:20 PM, Gonzalo Servat <gservat@gmail.com> wrote:> On Thu, Oct 13, 2011 at 2:25 AM, Nigel Kersten <nigel@puppetlabs.com>wrote: > >> >> Are you saying you''re sourcing files from outside the current environment >> for the client? >> >> if you put your files into modules that differ per environment, then >> something like: >> >> puppet:///modules/mymodule/myfile >> >> will resolve to $modulepath/mymodule/files/myfile separately for each >> environment automatically. >> > > Ah, so then I would need to specify a different modulepath per environment, > right? >Yes, although note that modulepaths can have multiple components, and individual components can be shared across environments e.g. [environment1] modulepath = /path/to/common_modules:/path/to/environment1_modules [environment2] modulepath = /path/to/common_modules:/path/to/environment2_modules> - Gonzalo > > -- > 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. >-- Nigel Kersten Product Manager, Puppet Labs -- 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.