title: Installing a puppet module from a manifest script
body: <p>I'm using puppet to provision a vagrant (ubuntu based) virtual machine.
  In my script I need to:</p>
  
  <pre><code>sudo apt-get build-dep python-lxml
  </code></pre>
  
  <p>I know I can install the <code>apt</code> <a href="https://forge.puppetlabs.com/puppetlabs/apt">puppet module</a> so I can use:</p>
  
  <pre><code>apt::builddep { 'python-lxml': }
  </code></pre>
  
  <p>But I can't find any reference about installing a module from the script and how to include/require it. Seems to me that the puppet docs refer only to <a href="http://docs.puppetlabs.com/puppet/2.7/reference/modules_installing.html#installing-from-a-release-tarball">installing from the command line puppet tool</a></p>
  
  <p>I also tried doing something like:</p>
  
  <pre><code>define build_dep($pkgname){
      exec {
      "builddepend_$pkgname":
      commmand =&gt; "sudo apt-get build-dep $pkgname";
      }
  }
  build_dep{
      "python-imaging":
      pkgname =&gt; "python-imaging";
  
      "python-lxml":
      pkgname =&gt; "python-lxml";
  }
  </code></pre>
  
  <p>But puppet exited with an error on this. And also:   </p>
  
  <pre><code>exec{"install apt module":
  
      command =&gt; "puppet module install puppetlabs/apt"
  }
  
  class { 'apt':
          require =&gt; Exec["install apt module"]}
  include apt
  
  apt::builddep { 'python-imaging':
   }
  </code></pre>
  
  <p>but got <code>could not find declared class apt at..</code></p>
  
  <p>any ideas? directions? I know I'm missing something obvious but can't figure this out.</p>
  
  <p><strong>EDIT:</strong> If I pre-install (with <code>puppet module install</code> from the commandline) the <code>apt:builddep</code> works fine. <strong>But I need puppet to handle the module downloading and installation</strong>. Some of the other work arounds also work for the basic use case but won't answer my main question.</p>