Override Vagrant configuration settings locally (per-dev)

前端 未结 8 1313
说谎
说谎 2021-01-30 02:51

I\'d like the question to be answered in general, but to illustrate it, here\'s a use case:

I\'m using Vagrant for a simple LMAP project. I use standalone Puppet for pro

8条回答
  •  猫巷女王i
    2021-01-30 03:42

    I believe that's the exact use case that Nugrant plugin was created to solve. It allows each of your devs to have a .vagrantuser (which is a .gitignore-ed file) in YAML specifying custom configuration values then reference these values with ease in Vagrantfile.

    In your case, a proxied developer would have their .vagrantuser file looking like this:

    proxy: 'proxy.host:80'
    

    And your Vagrantfile would look like this (pseudo code, I don't really know ruby):

    Vagrant::Config.run do |config|
      config.vm.provision :puppet do |puppet|
        if config.user.has_key?('proxy')
          puppet.facter = { "proxy" => config.user.proxy }
        end
      end
    end
    

    You should bundle a sample/reference vagrantuser (i.e. vagrantuser.example) file for your devs to copy and adjust to their environment.

提交回复
热议问题