Re: [vagrant-up] Environment variables for the shell provisioner

681 views
Skip to first unread message

Simon McCartney

unread,
Oct 31, 2012, 6:55:16 AM10/31/12
to vagra...@googlegroups.com
Sounds like a useful feature to have, but I've no idea where to start on adding that functionality, sorry!

On 23 October 2012 22:42, Thomas Hudson <hud...@speakeasy.net> wrote:
First off, I'm new to Vagrant, but in the last three days I've managed to replace a large volume of cruft and manual processes with a 73 line Vagrant file. Needless to say I am very impressed.

Looking through the code, I didn't see this implemented, but it would really be nice.

My problem is that I am creating developer VM's, using the same Rightscale scripts used in production. These scripts are pulled using their REST API's. These scripts rely on environment variables to provide inputs.

What would be nice is something along the lines of:

  config.vm.provision :shell do |shell|
    shell.path = './rightscale-scripts/php.sh'
    shell.env['OPT_PHP_MODULES_LIST'] = 'php-devel php-mysql php-gd php-zts'
    shell.env['RS_REBOOT'] = 'false'
    shell.env['RS_DISTRO'] = 'centos'
  end

Current I am modifying the scripts on the fly to set these environment variables at the beginning of the script.

Does this seem like a valid enhancement? If someone could point me in the right direction, I can give a shot at adding this functionality.

Thomas





--
Simon McCartney

Thomas Hudson

unread,
Nov 9, 2012, 8:56:42 PM11/9/12
to vagra...@googlegroups.com
I was able to implement this pretty easily in a slightly different way:

  config.vm.provision :shell do |shell|
    shell.path = './rightscale-scripts/php.sh'
    shell.environment_variables = {'OPT_PHP_MODULES_LIST' => 'php-devel php-mysql php-gd php-zts',
                                                 :rs_reboot =>  false, # symbol will use .to_s and .upcase
                                                 :rs_distro => 'centos'}
  end

Unfortunately, my solution works for only Unix-ish systems. May have to research window-isms before I submit a patch.
Reply all
Reply to author
Forward
0 new messages