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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
On Feb 27, 2009, at 4:13 PM, Jason Slagle 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?You''ve got a strange modeling problem, and I don''t know that there''s a simple way to implement the specific model you''ve chosen. You should be able to do something like this in the code that creates the host: if ! defined(Host[$fqdn]) { host { $fqdn: .... } } But you''ve chosen what amounts to a recursive process here: If the hosts can look up their own information, there isn''t really any value to putting it in the hosts file, is there? Seems redundant and potentially self-referential, if they''re using the existing hosts file to look up the information. Seems to make more sense to pick a specific data source, like dns or some external host table, and rely on that explicitly for building your hosts file. One option, used successfully for users -- and there''s a lot more crossover in managing the types than is obvious -- is to have a single class with all hosts defined as virtual resources, and then just select the ones you want: class hosts { @host { foo: ipaddress => bar, ...; ... } } class myservice { realize(Host[foo]) } You can then realize a given host (e.g., mgmt01) as many times as you want while keeping just one copy in your configuration. If you use this then you have to statically declare all of this, which is probably a bit redundant since you also likely have it in DNS. There are ways to mitigate that, too, but you''re clearly in the realm of "I have a complicated system and would like to spend a bunch of time on it". -- Sometimes I think we''re alone. Sometimes I think we''re not. In either case, the thought is staggering. --R. Buckminster Fuller --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
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 <raistlin@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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Hey, I''m pretty new to Puppet, but if you cut and paste from your existing configuration, perhaps this could be your problem: Jason Slagle wrote:> $myhosts = [$hostname, $extrahosts] > $myhost = $hostnameYou have $myhosts vs $myhost. You then only reference $myhost:> alias => $myhost,Not sure if that''s it, but I thought I''d point it out. :) cYa, Avi --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
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 <raistlin@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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Apparently Analagous Threads
- samba_dnsupdate options: --use-samba-tool vs. --use-nsupdate, and dhcpd dynamic updates
- samba_dnsupdate options: --use-samba-tool vs. --use-nsupdate, and dhcpd dynamic updates
- samba_dnsupdate options: --use-samba-tool vs. --use-nsupdate, and dhcpd dynamic updates
- samba_dnsupdate options: --use-samba-tool vs. --use-nsupdate, and dhcpd dynamic updates
- samba_dnsupdate options: --use-samba-tool vs. --use-nsupdate, and dhcpd dynamic updates