Ashley Penney
2008-Jun-04 19:56 UTC
[Puppet Users] HOWTO: Bootstrapping environments without external node classifers.
Hi, I''ve just spent the day, after discussions with Volcane (who deserves all the credit for this idea) setting up my site to handle environments without having to use an external node classifier. I thought I''d just jot down quickly what I did in case it''s helpful to anyone else. To set the environment you need to edit puppet.conf on all your clients and insert "environment = environmentname", so to handle this we have reconfigured puppetmaster to use a default environment of bootstrap that then sets the variable in puppet.conf, allowing you to place a variable in your node statements which will then configure the node into an environment. I generally include baseclass on all my nodes, and have a templates.pp that includes this. I have switched to calling a define in each node that sets either ''include baseclass'' or ''include bootstrap'' depending on what environment is set, and I will list all the required bits below: site.pp --------- define defaultclass() { case $name { "": {include bootstrap} default: {include baseclass} } } node.pp ----------- node "examplenode" { $localenvironment = "development" defaultclass{$environment:} } templates.pp ------------------ class baseclass { include regularmodules } class bootstrap { include network include puppet include repos } puppet module in bootstrap --------------------------------------- class puppet { file { "/etc/puppet/puppet.conf": ensure => present, content => template("puppet/puppet.conf.erb"), } } In puppet.conf.erb -------------------------- [main] environment = <%= localenvironment %> puppet.conf on the puppetmaster ----------------------------------------------- [puppetmasterd] environments = production,development,bootstrap (stick your environments on here) environment = bootstrap [bootstrap] modulepath = /etc/puppet/modules/bootstrap --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ashley Penney
2008-Jun-04 20:58 UTC
[Puppet Users] Re: HOWTO: Bootstrapping environments without external node classifers.
Lak: Are we correct in that setting environment = bootstrap in [puppetmasterd] should mean that any client without an environment set in puppet.conf should attempt to use bootstrap? It still seems to be pulling from the development modules by default and I''m not sure if my define is broken or I''m misunderstanding how the default environment system works. On Wed, Jun 4, 2008 at 3:56 PM, Ashley Penney <apenney@gmail.com> wrote:> Hi, > > I''ve just spent the day, after discussions with Volcane (who deserves all > the credit for this idea) setting up my site to handle environments without > having to use an external node classifier. I thought I''d just jot down > quickly what I did in case it''s helpful to anyone else. To set the > environment you need to edit puppet.conf on all your clients and insert > "environment = environmentname", so to handle this we have reconfigured > puppetmaster to use a default environment of bootstrap that then sets the > variable in puppet.conf, allowing you to place a variable in your node > statements which will then configure the node into an environment. > > I generally include baseclass on all my nodes, and have a templates.pp that > includes this. I have switched to calling a define in each node that sets > either ''include baseclass'' or ''include bootstrap'' depending on what > environment is set, and I will list all the required bits below: > > site.pp > --------- > > define defaultclass() { > case $name { > "": {include bootstrap} > default: {include baseclass} > } > } > > node.pp > ----------- > > node "examplenode" { > $localenvironment = "development" > defaultclass{$environment:} > } > > > templates.pp > ------------------ > > class baseclass { > include regularmodules > } > > class bootstrap { > include network > include puppet > include repos > } > > puppet module in bootstrap > --------------------------------------- > class puppet { > > file { "/etc/puppet/puppet.conf": > ensure => present, > content => template("puppet/puppet.conf.erb"), > } > } > > In puppet.conf.erb > -------------------------- > > [main] > environment = <%= localenvironment %> > > puppet.conf on the puppetmaster > ----------------------------------------------- > > [puppetmasterd] > environments = production,development,bootstrap (stick your > environments on here) > environment = bootstrap > [bootstrap] > modulepath = /etc/puppet/modules/bootstrap > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Evan Hisey
2008-Jun-04 21:07 UTC
[Puppet Users] Re: HOWTO: Bootstrapping environments without external node classifers.
On Wed, Jun 4, 2008 at 3:58 PM, Ashley Penney <apenney@gmail.com> wrote:> Lak: > > Are we correct in that setting environment = bootstrap in [puppetmasterd] > should mean that any client without an environment set in puppet.conf should > attempt to use bootstrap? It still seems to be pulling from the development > modules by default and I''m not sure if my define is broken or I''m > misunderstanding how the default environment system works.make you want to do work. make the following changes: puppet.co> I was about to reply to orginal post on this. You are missing a key point. I ran in to this also when setting this. Here is the break down of the issue: 1) The client overrides the the server environmentsetting everytime. This good lets you set client enviroments. 2) The client default environment is development. This can be bad as it will always override the Server environment. To make what you want work, remove the environment setting from [puppetmasterd]. The first time you launch puppetd have launch puppetd --environment=bootstrap to use the bootstrap environment. If you want the long and grit discussion on this check the archives. I sort of set off a long discussion about this a few months ago. Evan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Evan Hisey
2008-Jun-04 21:13 UTC
[Puppet Users] Re: HOWTO: Bootstrapping environments without external node classifers.
> make you want to do work. make the following changes: > > > puppet.co>Ignore the above snippet in the last mail. it got stuck in there by accident. Evan> I was about to reply to orginal post on this. You are missing a key > point. I ran in to this also when setting this. Here is the break down > of the issue:--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---