On Thu, Jun 9, 2011 at 07:40, Jonathan Gazeley
<jonathan.gaze...@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 <dan...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to