On Aug 9, 2012, at 5:42 PM, Tim Mooney <tim.moo...@ndsu.edu>
 wrote:

> In regard to: Re: [Puppet Users] how to resolve hostnames to IP addresses...:
>
>> if you're using hiera, why not something like:

[…]
heh yeah,

okay, so, well, uh... I didn't say it was a GOOD idea ;)

> Thanks for the fully-formed example Wolf.  John's subsequent response
> was spot-on as to why I would like to avoid duplicating the IPs in the
> data structure.  They won't change frequently, but at the same time,
> I really don't want to have to manually duplicate and sync information
> that's stored in our DNS.

I didn't know if they were already being defined somewhere else similarly, and 
thought if there was already a hash defining them in some way, you could just 
tack the ip in and call it a day.

>
> I do have one follow-on question regarding your example, though.
>
> Did you choose foo_data_webfarm_http_servers as the "top level" hiera
> name for any particular reason, such as how hiera is going to work in
> puppet 3 with parameterized classes?

I have no real knowledge of how that's going to work; I have been namespacing 
things based on what I felt made things very clear for people looking at the 
hiera values, and the templates.

afaik there's no significant penalty for longish names, but it makes it a bit 
easier for me to ingest when looking through a gaggle of hiera parameters.

>
> I must admit that while I find hiera fantastic, I've really struggled
> with how our complex data should be organized in hiera.  I'm looking
> forward to the hiera examples that Kelsey Hightower mentioned a couple
> weeks ago on the list, but seeing examples like this in the interim is
> really helpful and appreciated.

for what it's worth, happy to help…

this gave me another idea, however which I'll create a new thread on rather 
than hijack this one

>
> Tim
>
>> On Aug 9, 2012, at 3:38 PM, Tim Mooney <tim.moo...@ndsu.edu>
>> wrote:
>>
>>>
>>> Environment: puppet 2.7.14 on both master and all clients.  We're also
>>> using puppetlabs-stdlib and hiera, if that matters.
>>>
>>> I know this is really more of a ruby/erb question, but I've been searching
>>> for a couple hours and haven't turned up anything relatively close to what
>>> I'm trying to do, and I'm hoping someone here has had to do this and can
>>> provide a suggestion for how to proceed.
>>>
>>> I'm generating a configuration file from a template.  The configuration
>>> file will need to have IP addresses in it, but I would like to be able to
>>> use either hostnames or IP adresses in the puppet config.  This means
>>> that I need to be able to resolve the hostnames and turn them into IP
>>> addresses, probably in the template itself.
>>>
>>> Basically, given something like this in puppet:
>>>
>>> class foo::data {
>>>
>>> $webfarm = {
>>>   http_servers => hiera('webfarm_http_servers', [
>>>     {
>>>       host => 'foo1.example.com',
>>>       port => '80',
>>>        },
>>>     {
>>>       host => 'foo2.example.com',
>>>       port => '80',
>>>        },
>>>     {
>>>       host => 'foo3.example.com',
>>>       port => '80',
>>>        },
>>>   ]),
>>>   https_servers => hiera('webfarm_https_servers', [
>>>     {
>>>       host => 'foo1.example.com',
>>>       port => '443',
>>>        },
>>>     {
>>>       host => 'foo22.example.com',
>>>       port => '443',
>>>        },
>>>     {
>>>       host => 'foo99.example.com',
>>>       port => '443',
>>>        },
>>>   ]),
>>> }
>>> }
>>>
>>> I need my template to iterate over the http_servers and https_servers
>>> arrays and resolve the values for the host key for each element.
>>>
>>> Anyone have an example of how to do this in a template?
>>>
>>> Thanks,
>>>
>>> Tim
>>> --
>>> Tim Mooney                                             tim.moo...@ndsu.edu
>>> Enterprise Computing & Infrastructure                  701-231-1076 (Voice)
>>> Room 242-J6, IACC Building                             701-231-8541 (Fax)
>>> North Dakota State University, Fargo, ND 58105-5164
>>>
>>> --
>>> 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.
>>>
>>
>>
>> ________________________________
>>
>> This message may contain confidential or privileged information. If you are 
>> not the intended recipient, please advise us immediately and delete this 
>> message. See http://www.datapipe.com/legal/email_disclaimer/ for further 
>> information on confidentiality and the risks of non-secure electronic 
>> communication. If you cannot access these links, please notify us by reply 
>> message and we will send the contents to you.
>>
>>
>
> --
> Tim Mooney                                             tim.moo...@ndsu.edu
> Enterprise Computing & Infrastructure                  701-231-1076 (Voice)
> Room 242-J6, IACC Building                             701-231-8541 (Fax)
> North Dakota State University, Fargo, ND 58105-5164
>
> --
> 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.
>


________________________________

This message may contain confidential or privileged information. If you are not 
the intended recipient, please advise us immediately and delete this message. 
See http://www.datapipe.com/legal/email_disclaimer/ for further information on 
confidentiality and the risks of non-secure electronic communication. If you 
cannot access these links, please notify us by reply message and we will send 
the contents to you.

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