Use foreman search in manifest


Any examples of using a foreman search inside of a puppet manifest would be
greatly appreciated.

In particular, I'd like to grab the sshrsakey fact for a specific host.
I've tried the following, but obviously don't have it down quite yet.

Many thanks!

··· ------
  $query = {

    item   => 'fact_values',

    search => 'host=lnx901',

    foreman_url => 'https://our.foreman.server',

    foreman_user => 'user',

    foreman_pass => 'pass'


  $lnx901 = foreman($query)

  sshkey { "lnx901":

    key          => $lnx901["sshrsakey"], 

    host_aliases => "lnx901-p12",

    type         => "ssh-rsa",

    ensure       => "present",