Hi all, I haven''t used exported resources before, and I''m finding it a little confusing. Basically I want Puppet to know which of the servers have the DNS servers class applied to them, so it can use these servers'' IP addresses when it generates the DHCP config. This way, if we add or remove DNS servers, the DHCP is automatically regenerated. It doesn''t sound too hard, but I can''t quite see to achieve this. Can anyone give me a few pointers, please? Thanks, Jonathan -- 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.
On Thu, Jun 9, 2011 at 5:40 PM, Jonathan Gazeley < jonathan.gazeley@bristol.ac.uk> wrote:> Hi all, > > I haven''t used exported resources before, and I''m finding it a little > confusing. > > Basically I want Puppet to know which of the servers have the DNS servers > class applied to them, so it can use these servers'' IP addresses when it > generates the DHCP config. > > This way, if we add or remove DNS servers, the DHCP is automatically > regenerated. > > if you use bind, note that you might have an issue with the serial in thefile. for one, I dont manage dns/dhcp using puppet. Ohad> It doesn''t sound too hard, but I can''t quite see to achieve this. Can > anyone give me a few pointers, please? > > Thanks, > Jonathan > > -- > 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. > >-- 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 Pittman
2011-Jun-09 17:46 UTC
Re: [Puppet Users] Exported resources for DNS and DHCP
On Thu, Jun 9, 2011 at 07:40, Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk> wrote:> I haven''t used exported resources before, and I''m finding it a little > confusing. > > Basically I want Puppet to know which of the servers have the DNS servers > class applied to them, so it can use these servers'' IP addresses when it > generates the DHCP config. > > This way, if we add or remove DNS servers, the DHCP is automatically > regenerated. > > It doesn''t sound too hard, but I can''t quite see to achieve this. Can anyone > give me a few pointers, please?Yeah. So, one of the current problems with storeconfigs is that it only serves to inject resource declarations into another host. You can''t really manage the data itself, so you have to put *something* physical somewhere to make it work. When I had similar problems I took one of two approaches: One, inject textual content into the target file directly, either using ''file'' resources and include statements in the configuration, or using one of the concatenated file providers, and exporting / importing a fragment from the DNS server to the DHCP server. If neither of those worked, the other approach I took was painfully indirect: export a file with the data, import that on the master, then use the ''generate'' function to extract that on the master when I built the target system. For example, on the DNS server, create this exported resource: @@file { "/datastore/dns-${fqdn}.data": content => "ip ${ipaddress}\n", tag => ''data'' } Then, on the master import that, and use a little Perl script to read /datastore/dns-*.data, parse out the IP value, and inject that: class dhcp { $dns = generate(''/u/l/bin/extract-data'', ''dns'', ''ip'') # ...and that is the data I need. } Regards, Daniel -- ⎋ Puppet Labs Developer – http://puppetlabs.com ✉ Daniel Pittman <daniel@puppetlabs.com> ✆ Contact me via gtalk, email, or phone: +1 (877) 575-9775 ♲ Made with 100 percent post-consumer electrons -- 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.
Jonathan Gazeley
2011-Jun-24 09:32 UTC
Re: [Puppet Users] Exported resources for DNS and DHCP
On 06/09/2011 06:46 PM, Daniel Pittman wrote:> On Thu, Jun 9, 2011 at 07:40, Jonathan Gazeley > <jonathan.gazeley@bristol.ac.uk> wrote: > >> I haven''t used exported resources before, and I''m finding it a little >> confusing. >> >> Basically I want Puppet to know which of the servers have the DNS servers >> class applied to them, so it can use these servers'' IP addresses when it >> generates the DHCP config. >> >> This way, if we add or remove DNS servers, the DHCP is automatically >> regenerated. >> >> It doesn''t sound too hard, but I can''t quite see to achieve this. Can anyone >> give me a few pointers, please? > > Yeah. So, one of the current problems with storeconfigs is that it > only serves to inject resource declarations into another host. You > can''t really manage the data itself, so you have to put *something* > physical somewhere to make it work. > > When I had similar problems I took one of two approaches: > > One, inject textual content into the target file directly, either > using ''file'' resources and include statements in the configuration, or > using one of the concatenated file providers, and exporting / > importing a fragment from the DNS server to the DHCP server.Thanks for your response, very helpful. I''ve only just got round to finding time to work on this again. Please can you expand on the two things you mentioned above - I''m not sure I fully understand. At the moment we are using Puppet in a fairly noddy way, and I''m keen to get to grips with its more advanced features. Many thanks, Jonathan> > If neither of those worked, the other approach I took was painfully > indirect: export a file with the data, import that on the master, then > use the ''generate'' function to extract that on the master when I built > the target system. > > For example, on the DNS server, create this exported resource: > > @@file { "/datastore/dns-${fqdn}.data": content => "ip > ${ipaddress}\n", tag => ''data'' } > > Then, on the master import that, and use a little Perl script to read > /datastore/dns-*.data, parse out the IP value, and inject that: > > class dhcp { > $dns = generate(''/u/l/bin/extract-data'', ''dns'', ''ip'') > # ...and that is the data I need. > } > > Regards, > Daniel-- 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.