shellubuntuvagrantpuppet

Set Environment Variables with Puppet


I am using vagrant with puppet to set up virtual machines for development environments. I would like to simply set a few environment variables in the .pp file. Using virtual box and a vagrant base box for Ubuntu 64 bit.

I have this currently.

$bar = 'bar'

class foobar {
   exec { 'foobar':
     command => "export Foo=${bar}",
   }
}

but when provisioning I get an error: Could not find command 'export'.

This seems like it should be simple enough am I missing some sort of require or path for the exec type? I noticed in the documentation there is an environment option to set up environment variables, should I be using that?


Solution

  • If you only need the variables available in the puppet run for all exec resources, whats wrong with :

    Exec { environment => [ "foo=$bar" ] }
    

    ?