Howdy: I need some help please to get hiera configuration data derived from YAML, thru puppet. I have studied Internet search results and puppet documentation on create_resources and custom defines but need a little help along. I can print out the YAML from variables, arrays, and, finally, hashes too from a puppet manifest.
One thing that is stumping me is how to access from the custom define only the YAML element of server-a which is I believe is an object of an array of hashes as I have the YAML laid out. When I run this on client host server-a against the manifest this prints out in the log: Aug 17 12:59:09 puppet puppet-master[67407]: (Scope(Sshd_lookup[server-a])) setting sshd_type: local Aug 17 12:59:09 puppet puppet-master[67407]: (Scope(Sshd_lookup[server-b])) setting sshd_type: local Aug 17 12:59:09 puppet puppet-master[67407]: (Scope(Sshd_lookup[server-c])) setting sshd_type: local Aug 17 12:59:09 puppet puppet-master[67407]: (Scope(Sshd_lookup[server-d])) setting sshd_type: local I want it to print out just server-a's value. How do I do that? Also, interestingly, it printed out each of the server names (keys?) in the hash but the value of the server-a's sshd_auth entry. My YAML, puppet manifest and error follow. # cat common.yaml --- searchdomain : 'example.com' ssh_auth : ldap servers : server-a : sshd_auth: "local" ClientAliveInterval: "nil" ClientAliveCountMax: "nil" server-b : sshd_auth: "local" ClientAliveInterval: "nil" ClientAliveCountMax: "nil" server-c : sshd_auth: "ldap" ClientAliveInterval: "nil" ClientAliveCountMax: "nil" server-d : sshd_auth: "ldap" ClientAliveInterval: "10" ClientAliveCountMax: "3" # cat ../hiera.yaml --- :backends: - yaml :logger: console :hierarchy: - %{hostname} - common :yaml: :datadir: /usr/local/etc/puppet/hieradata # cat Inuit.pp class user { $sshd_hash = hiera(servers) create_resources('sshd_lookup', $sshd_hash) } define sshd_lookup ( $sshd_auth, $ClientAliveInterval, $ClientAliveCountMax, $server_role, $location ) { $data = hiera_hash('servers') $sshd_type = $data[$hostname]['sshd_auth'] notice ("setting sshd_type: $sshd_type" ) } Thanks, Regards, -dkw -- 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.