More detail is needed to answer the question.

Here are (I hope) some helpful suggestions:

The data you list is a hash.
How does one get the first "element" from a hash ?

In what context are you trying to access the information ?  Manifest ?  
Template ?  No in Puppet at all ?

One thing that caught my eye: The top-mose key of the hash is "node" while the template 
code says "nodes".  That could be the problem.

“Sometimes I think the surest sign that intelligent life exists elsewhere in the 
universe is that none of it has tried to contact us.”  (Bill Waterson: Calvin & 
Hobbes)


On Feb 25, 2015, at 08:52 AM, Fran Rodríguez <[email protected]> wrote:

Hi group,

Im trying to get one element from a yaml structure which come from Foreman, the 
yaml is like this:

node :
   host1 :
      ip : xxx . xxx . xxx
   host2 :
      ip : xxx . xxx . xxx


Those parameter are used to in a template:

<%= @nodes [ 0 ][ name ] %> IPaddr2:: <%= @nodes [ 0 ][ 'ip' ] %>/ <%= @nodes [ 0 ][ 
'cidr' ] %>/ <%= @nodes [ 0 ][ 'interface' ] - %>

The question is that i only need the first parameter, i tried some ways to do 
it but without any luck, so if someone could put me on the correct way or tell 
me what i would have to do....

Thanks.


--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/13ed1412-5807-424e-971e-284e588411c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/9b26a896-77fa-4542-b520-02917eea0f94%40me.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to