Joe Esposito
2011-Feb-07 17:12 UTC
[Puppet Users] Pattern for modifying a "master node" when a "slave node" is configured with puppet
Hi there! I''m somewhat new to puppet, and just got back from PuppetLabs training in Boston last week. One pattern that i didn''t consider until after the class is how to update a master node when a slave node is brought online.. I have anode called dispatcher and several slaves called slave1..2..3,etc. When slave3 is puppetized (ie built via puppet), several files need to be modified on the dispatcher machine to let it know that slave3 now exists. I can see having a build script that runs on puppet master and keeps those files in /etc/puppet/files/dispatcher/* updated, but that seems more like the old way I''ve done things. Is there a "puppet" way to do something like this. Thanks! -- 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.
Stefan Schulte
2011-Feb-09 06:11 UTC
Re: [Puppet Users] Pattern for modifying a "master node" when a "slave node" is configured with puppet
On Mon, Feb 07, 2011 at 12:12:45PM -0500, Joe Esposito wrote:> Hi there! I''m somewhat new to puppet, and just got back from PuppetLabs > training in Boston last week. One pattern that i didn''t consider until > after the class is how to update a master node when a slave node is brought > online.. > > I have anode called dispatcher and several slaves called slave1..2..3,etc. > > When slave3 is puppetized (ie built via puppet), several files need to be > modified on the dispatcher machine to let it know that slave3 now exists. > > I can see having a build script that runs on puppet master and keeps those > files in /etc/puppet/files/dispatcher/* updated, but that seems more like > the old way I''ve done things. > > Is there a "puppet" way to do something like this. > > Thanks! >Yes, there is a way: http://docs.puppetlabs.com/guides/exported_resources.html In short: You have to enable storeconfigs on the master. Then you can do something like (not tested, maybe syntax errors) # In your slaves manifest @@file { "/master/${fqdn}.conf": content => "I am $fqdn to your service\n", ensure => file, tag => "dispatcher_slave", } When the you run puppet on the slave now, the slave will not install that file on its own system but the file resource (with resolved facts like fqdn will be exported to the master which will now store the resource in a database (sqlite, MySQL, whatever you configured). You can install that file on any host now. # In your dispatcher''s manifest File <<| tag == "dispatcher_slave" |>> This will realize every exported file that is tagged with "dispatcher_slave". So on your dispatcher you will now have a file called /master/slave1.conf with »I am slave1 to your service«. Setting up stored config is described here: http://projects.puppetlabs.com/projects/1/wiki/Using_Stored_Configuration Hope that helps. -Stefan