Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I also use puppet for my nodes. I am also running a (BIND) dns server.

Would it be possible to use the $aliases variable I have for each node in a template for the DNS module?

My nodes look like this:

$ cat nodes/kayak.local.pp
node 'kayak.local' {
  include base
  $node_aliases = ['svn','puppet']
  $node_primaryip = '10.0.64.200'

  network::interface { 'eth0':
    ip      => $node_primaryip,
    gw      => '10.0.64.1',
    mac     => '00:50:00:00:00:3f',
    netmask => '255.255.255.0',
  }

}

What I am looking for is being able to make a template like this:

$cat local.erb

<% scope.lookupvar('ALLNODES::aliases').each do |alias| -%>
<%= alias %> IN A <%= node_primaryip %>
<% end -%> 

who can help me?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

You could use exported resources for that.

  • create a defined type that manages a line in your dns file
  • on each host, create a resource that uses that defined type. Use @@ before the type to make it exported.
  • Collect those resources on your DNS server with the spaceship operator.

Sidenote: use Hiera for all that data in your manifest.

share|improve this answer
    
Thanks. Had to do some searching there. I think I understand what I need to do. Haven't read about hiera though. Would that make solving my 'problem' easier? –  Karlo Apr 10 '13 at 5:29
1  
Hiera is pretty awesome in seperating data from your code... - docs.puppetlabs.com/hiera/1/puppet.html –  Ger Apeldoorn Apr 10 '13 at 11:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.