Wednesday, October 31, 2012

Puppet DNS lookup

From time to time NetworkManager breaks my /etc/resolv.conf. I normally turn that off using puppet but when /etc/resolv.conf is broken, puppet won't run so I have to fix it manually :-(

Well, not any more. Now I add a static /etc/hosts entry for the puppet server and puppet will run even when /etc/resolv.conf is broken.

The special part about this is that I look up the IP address using a template so I don't have to hard code the value in my manifest. Google said it could not be done without writing a custom function. As always, I did not believe it...

Assuming you have set $puppetserver to contain the fqdn of your puppet server:

host { 'hostsconf-puppet':
        ensure => present,
        ip => inline_template("<% _erbout.concat(Resolv::DNS.open.getaddress('$puppetserver').to_s) %>"),
        name => $puppetserver,
        target => '/etc/hosts',
}



14 comments:

  1. Hooray for no more manual fixes! And what a simple solution it was, too. This is definitely one of those things that you put up with for a long time until one day you're just like "enough!" and actually do something about it. And that something takes like two seconds and you should've done it months ago.

    Better late than never?

    Fred | https://webhostinggeeks.com/tools/

    ReplyDelete
    Replies
    1. There is a really high amount of enjoyment in any Betiton canada machine casino. The payout and house advantage vary depending on the casino game. At this point, you are considering the house's perimeter. Fear not; I'll explain the house advantage and show you how to choose the casino game that will make you the most money.

      Delete
  2. Wonderful goods from you, man. I have understand your stuff previous to and you’re just extremely magnificent. I actually like what you’ve acquired here, certainly like what you are saying and the way in which you say it. You make it entertaining and you still care for to keep it wise.
    I can’t wait to read much more from you. This is really a great web site.

    films altadefinizione

    ReplyDelete
  3. Very interesting content. Thanks.

    Lucy Hennessy, for more info visit my Homepage

    ReplyDelete
  4. This is known as the cbd water entourage effect and is the reason our products are potent and effective.

    ReplyDelete
  5. For example, an essay is completed between 3 and 7 hours. Research papers https://rankmywriter.com/payforessay-net-review only require 24 to 48 hours to write properly, and our professionals require the maximum of a week to research and write dissertations.

    ReplyDelete
  6. Very recommended service navigate to this web-site, their editors write the professional essay, also very patient for revisions. I have used this service for at least 5 papers now, and been happy with the service on all of them. Most of the time it is done before the deadline. Online customer service is also quick to respond to questions. I will continue to use them in the future!

    ReplyDelete

  7. عندما نتحدث عن نقل العفش فنحن امام مهمه صعبه جدا على بعض الاشخاص لان بعض الاشخاص يمتلكون العفش الكثير ممما يحتاج الى تغليف وتعبيئه ونقل بشكل مثالى حتى لا يكون فيه خدوش او تلفيات او تكسير ومن هنا تظهر خدماتنا فى القيام بنقل عفش مثالى دون اى تعب او مجهود او تكاليف باهظه

    زهرة الشرقيه لنقل الاثاث بالدمام
    شركة تركيب اثاث ايكيا بالدمام
    شركة نقل عفش بالاحساء

    ReplyDelete
  8. I was very pleased to find this web-site. I wanted to thanks for your time for this wonderful read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you blog post.

    Fmfreaks.dk
    Information
    Click Here
    Visit Web

    ReplyDelete
  9. Great blog! Our new service https://topessaybrands.com/review/zipjob/ provides our customers with a list of 15 unique topics for the needed subject. Get in touch with us, and we will provide you with the most suitable specialist to handle your task on an individual basis. Pick one among 15 special topics and get it done.

    ReplyDelete
  10. If you have specific topics or problems that you need to splash learn reviews address, you may need a tutor who specializes in that particular area.

    ReplyDelete