Combine Two hash in Puppet
<p>i have 2 hash, and need to "combine" them to make a new ssh_authorized_key resource: </p>

<p>First hash contains all ssh keys</p>

<pre><code>$ssh_keys = {
 'user1@192.168.14.47' =&gt; {
    type =&gt; 'ssh-rsa',
    key  =&gt; 'Key1',
 },
 'user2@192.168.18.10' =&gt; {
    type =&gt; 'ssh-rsa',
    key  =&gt; 'Key2',
  }
}
</code></pre>

<p>second hash contains the "deploys" of the keys and users</p>

<pre><code>$deploys = {
    'user1@192.168.14.47' =&gt; { user =&gt; ["user3","user4"]},
    'user2@192.168.18.10' =&gt; { user =&gt; ["user3"]}
}
</code></pre>

<p>I want to "merge" this hashes so i can use create_resources</p>

<pre><code>$newhash ={
    'user1@192.168.14.47' =&gt; {
    type =&gt; 'ssh-rsa',
    key  =&gt; 'Key1',
    user =&gt; ["user3","user4"]
 },
 'user2@192.168.18.10' =&gt; {
    type =&gt; 'ssh-rsa',
    key  =&gt; 'Key2',
    user =&gt; ["user3"]
  }
}

create_resources('ssh_authorized_key',$newhash)
</code></pre>

<p>how can i create the newhash? puppet do not have iteration which make this way to difficult</p>

<p>The data of the hashes eventually comes from foreman smart classes/variables</p>

<p><strong>Edit:</strong>
This is on foreman 1.11.1 with puppet 3.8.7 in ubuntu 14.04</p>