title: Store contents of a file in a variable
body: <p>I am trying to extract the contents of a file and store it in a variable. My code looks like this.</p>
  
  <pre><code>define ssh_user (
          $name = undef,
          $role = undef,
          $password = undef,
          $usergroup = undef, ) {
  
                  user { $name:
                          home =&gt; "/home/${name}/",
                          ensure =&gt; present,
  
                  }-&gt;
  
                  exec { "generate keys ${name}":
                          user =&gt; $name,
                          command =&gt; '/bin/echo -e "\n\n\n" | ssh-keygen -t rsa',
                          path =&gt; "/usr/bin/",
                  }-&gt;
                 file { "/home/${name}/.ssh/auhorized_keys":
                          ensure =&gt; file,
                          mode =&gt; 700,
                          source =&gt; "/home/${name}/.ssh/id_rsa.pub",
                 } 
                  @@node_user { $name:
                          require =&gt; File["/home/${name}/.ssh/auhorized_keys"],
                          key =&gt; file('/home/${name}/.ssh/id_rsa.pub'),    ## line causing error
                          role =&gt; "ssh::users::${name}::role",
                  }
  }
  </code></pre>
  
  <p>I get the following error,</p>
  
  <pre><code>Error: Could not find any files from /home/${name}/.ssh/id_rsa.pub at /etc/puppet/manifests/sshd_setup.pp:90 on node puppet.colo.seagate.com
  Error: Could not find any files from /home/${name}/.ssh/id_rsa.pub at /etc/puppet/manifests/sshd_setup.pp:90 on node puppet.colo.seagate.com
  </code></pre>
  
  <p>I am creating files for a set users and storing the contents of the file in a varaible.
  After storing the file contents in a variable I am using it to create an exported resource.</p>
  
  <p>I tried using "require"  and "->" for ensuring the  ordering between my resources; but it turns out the error may be because of the path to my file (it contains a variable name).</p>