Don't get me wrong - I am using DNS.  I have 3 entries I want in each host 
file.  The primary production DB server (I don't want to run caching DNS 
everywhere, and I connect to it a lot.  It's also a failsafe if there are 
DNS issues) - the management box with puppet, and localhost.

Jason

-- 
Jason Slagle - RHCE
/"\ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
\ /   ASCII Ribbon Campaign  .
  X  - NO HTML/RTF in e-mail  .
/ \ - NO Word docs in e-mail .


On Fri, 27 Feb 2009, Trevor Vaughan wrote:

>
> Just out of curiosity, why aren't you using DNS?
>
> If you were, you could easily map your DNS to a hosts file for speed
> and synchronize it regularly.
>
> Alternatively, you could use a custom function on the server to make
> it all work for you.
>
> Trevor
>
> On Fri, Feb 27, 2009 at 17:13, Jason Slagle <raist...@tacorp.net> wrote:
>>
>> Ok, so I figured I'd move this here since IRC isn't the place for it.
>>
>> Ok, so I have my 40ish servers.  Of those, 36 or so of them have hosts
>> entries that need to look like this:
>>
>> 127.0.0.1               localhost
>> 172.x.x.x               dbprod1.xxx.com dbprod1
>> 172.x.x.x               mgmt01.xxx.com mgmt01 puppet certmaster
>> 172.x.x.x               mybox.xxx.com mybox
>>
>> Where mybox is the name of the box.
>>
>> The others have a few additional entries.
>>
>> So, I made a class that creates those hosts entries and I include it on my
>> host.
>>
>> Part of the class does this:
>>
>>   host { "${fqdn}":
>>     ip => $ipaddress,
>>     alias => $hostname,
>>   }
>>
>> Seems simple enough eh?
>>
>> The issue comes up with those few exception.  In particular on the mgmt01
>> box.  It blows up because it I end up redefining the host, which is a
>> nono.
>>
>> So - lightbulb goes off in head.  I'll add a case to the class that checks
>> if the fqdn is one of the ones I manually insert, and if so I'll skip it.
>>
>> Now to me, this is a bad solution because it puts node specific logic
>> inside a class - I think that from a architecture/reusable component/large
>> scale perspetive that stuff belongs at the node definition.  I guess I
>> could just not use my host class on my exception.
>>
>> So, my next attempt was this:
>>
>> node mgmt01.xxx.com {
>>   $extrahosts = ["puppet", "certmaster"]
>>   include hosts
>> }
>>
>> So, I thought this would work:
>>
>> if $extrahosts {
>>   $myhosts = [$hostname, $extrahosts]
>> } else {
>>   $myhost = $hostname
>> }
>>
>>   host { "${fqdn}":
>>     ip => $ipaddress,
>>     alias => $myhost,
>>   }
>>
>> Still have the case to handle the duplicate type, but this allow me to
>> specify the extra aliases and handles the rest of my cases.
>>
>> But, this doesn't work.
>>
>> It would seem that the above not working in SOME form really limits the
>> ability to write modules/classes that work in 90% of the cases and can be
>> overridden in the other 10%.  This simplifies configuration a lot.
>>
>> Am I just doing something wrong?  Am I crazy?  Am I thinking too much like
>> a programmer?  Do I suck?
>>
>> Just looking for thoughts?
>>
>> Jason
>>
>> --
>> Jason Slagle - RHCE
>> /"\ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>> \ /   ASCII Ribbon Campaign  .
>>  X  - NO HTML/RTF in e-mail  .
>> / \ - NO Word docs in e-mail .
>>
>>
>>>
>>
>
> >

--~--~---------~--~----~------------~-------~--~----~
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