Hi all,
I have a hash of hashes in hiera:
cb_data_sync:
localdata:
peers: peer1 peer2
source: /data/1
target: /data/2
ssh_key:
key: XYZ
type: ssh-rsa
user: root
Then, in a main class, I call a define using the above data:
class cb_sync(
Hash $cb_sync = lookup(cb_data_sync),
) {
$cb_sync.each |$name, $data| {
cb_sync::rsync{ $name:
data_sync => $data,
}
}
}
so far, so good.
cb_sync::rsync is a define and there I'd like to create a
ssh_authorized_key from the ssh_key nested hash.
So, my code looks like:
define cb_sync::rsync (
Hash $data_sync = undef,
) {
ssh_authorized_key {
"${name}-ssh_key":
* => "${data_sync['ssh_key']}",
}
But puppet complains cause it says that it gets a string but expects a
Hash.
If I "notify" data_sync['ssh_key'] I get:
Notice: {key => XYZ, type => ssh-rsa, user => root}
(which looks like a hash to me,am I wrong?).
If I try to to create the suthorized_key using the next code:
ssh_authorized_key {
"${name}-ssh_key":
key => "${data_sync['ssh_key']['key']}",
type => "${data_sync['ssh_key']['type']}",
user => "${data_sync['ssh_key']['user']}",
}
Puppet does add the entry in the authorized_keys file....
So, what I'm not seeing here?
TIA,
Arnau
--
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/CAM69jx8RnODYGRR5RFeAkEOqbv9DwbkjOY%2B71_m0VdaR8cyvEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.