Ask Your Question
3

getting hiera data into my erb template

asked 2013-05-13 18:52:01 -0500

Red Cricket gravatar image

updated 2013-05-13 23:12:25 -0500

Hi All,

I have a cgi that is spits out json and we are able to see the data via hiera command line like so

    [red@mypuppetmaster ~]$ hiera list_of_internal_dns_ip_addresses
    {"dns-hhh1-1-l.example.com"=>"127.0.0.145", "dns-sss1-2-l.example.com"=>"127.0.0.156", "dns-bbb1-2-l.example.com"=>"127.0.0.22", "dns-eee1-2-l.example.com"=>"127.0.0.73", "dns-ttt3-1-l.example.com"=>"127.0.0.96", "dns-rrr1-1-l.example.com"=>"127.0.0.155", "dns-ttt3-2-l.example.com"=>"127.0.0.97", "dns-aaa1-1-l.example.com"=>"127.0.0.68"}
  • The hostnames and IP address are made up.

... so our hiera.yaml is good. Next ... (more)

edit retag flag offensive close merge delete

Comments

Note, the documentation discourages using hieralookups in templates: https://docs.puppetlabs.com/hiera/1/puppet.html#using-the-lookup-functions-from-templates

spuder gravatar imagespuder ( 2014-08-28 16:49:19 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-05-13 19:03:08 -0500

ramindk gravatar image

You have a simple mistake in your template. You're using a <%= at the start of your Ruby code on line 145 instead of a <% which you have correct in other places.

edit flag offensive delete link more

Comments

Thanks ramindk! <%= was definitively wrong. I will update my question with the code I am trying to use now.

Red Cricket gravatar imageRed Cricket ( 2013-05-13 20:37:51 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-05-13 18:52:01 -0500

Seen: 4,390 times

Last updated: May 13 '13