title: Symlinking a vagrant shared folder with puppet
body: <p>I'm needing to recreate a setup on an old server with vagrant where we served sites within the home directory. Its not possible to set a shared folder to /home in vagrant as this will remove the vagrant user. I therefore would like to create a shared folder that is actually a symlink to the home directory.</p>
  
  <p>If I create a shared directory like this in my Vagrantfile:</p>
  
  <pre><code>config.vm.share_folder "v-www", "/webroot", "/Users/me/sites/vagrant"
  </code></pre>
  
  <p>and then try and create a symlink with puppet overwriting this directory like this:</p>
  
  <pre><code>class misc {
    file { '/webroot':
     ensure =&gt; 'link',
     target =&gt; '/home',
     force =&gt; true,     
    }
  }
  </code></pre>
  
  <p>It throws an error:</p>
  
  <blockquote>
    <p>Error: Could not remove existing file</p>
    
    <p>Error: /Stage[main]/Misc/File[/webroot]/ensure: change from directory
    to link failed: Could not remove existing file</p>
  </blockquote>
  
  <p>When I log into the box and attempt this manually this also fails as i'm not actually able to remove the webroot - I assume this is because its created as some kind nfs share or something like that.</p>
  
  <p>Any ideas how I can get around this? </p>