Thank you very much Felix for you replay.
I got it now , but I have an other question:

I created file findarray.pp with this code inside:
define findarray(
   $sitearray = $title,
   $siteName
){
  notify{"ARRAY DEL SITIO - ${sitearray}":}
}

and call findarray from init.pp, with next code:
        $site_array = hiera("host_key")
        $prueba = keys($site_array)

        findarray{$prueba:
           siteName => $siteName
        }

this code return only ARRAY DEL SITIO - server1 and ARRAY DEL SITIO - 
server2.
How to get all data from hiera, why only get server1 and server2 and no 
other data?.

Thanks!!!



On Monday, October 6, 2014 3:29:22 PM UTC-3, Juan Andres Ramirez wrote:
>
> Hello guys, 
>           I have the next problem to get value of keys from 
> hieradata(common.yaml)
>
> 1- I have common.yaml :
>
> host_key:
>   - server1:
>     alias: webserver
>     ipadress: "192.168.0.4"
>     port : "80"
>   - server2:
>     alias: dbserver
>     ipadress: "192.168.0.5"
>     port : "80"
>   
> 2) init.pp
>
> Include stdlib
>
> $alldata = hiera_array("host_key")
>
> #look arrays:
> notify{"SEE THE ARRAYS: ${sitedefinition}":}
> #output:
>
> port80aliaswebserveripadress192.168.0.4server1port80aliasdbserveripadress192.168.0.5server2none
>
> My question is how can I get the data to server1 or server2? I know this 
> can work with Keys() but I dont know how.
>
> 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/3e11fdc5-fa2a-4985-9453-b3b55f3e766f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to