Hello again,

I don't get it... 
If I have the Hiera structure you propsed how do I get the data from Hiera 
(1) and how do I chop it into pieces so I can give parameters to 
sshkeys::keyentry($keyname, $key, $keytype, ..) (2)?

If I do it as you and Martin suggested, e.g. Hiera looks like this 
(space-idented):

sshkeys_keys:
  TEST:
    key: 'asdfasdfasdf123412341234'
    keytype: 'ssh-rsa'
    keyuser: 'root'
    ensure: 'present'
  TEST2:
    key: 'asdfasdfasdf123412341234'
    keytype: 'ssh-rsa'
    keyuser: 'root'
    ensure: 'present'

and my module looks like this:

    define keyentry($keyname, $key, $keytype, $keyuser, $ensure) {

        ssh_authorized_key {$keyname:
            ensure => $ensure,
            key    => $key,
            type   => $keytype,
            user   => $keyuser
        }
        
    }

    # Returns the most specific value for a given key
    $sshkeys = hiera("sshkeys_keys")
  
    # Return the keys of a hash as an array
    $sshkeys_keys = keys($sshkeys)
    
    notify{"${sshkeys_keys}":}

how do I get the values from the hashes in Hiera, so I can put them in 
variables and call the keyentry define? Or am I thinking too "normal 
programming languages"? :D
The last notify gives me only:

Notice: TEST2TEST
Notice: /Stage[main]/Sshkeys/Notify[TEST2TEST]/message: defined 'message' 
as 'TEST2TEST'

which looks like an array flattened to a string to me. Shoud the keys() 
function work like this?

Cheers,
Konstantin

-- 
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/fd398cdb-f8f9-46e9-b9bb-403d0bd70477%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to