Skip to content

Instantly share code, notes, and snippets.

@X0nic
Created July 3, 2014 22:36
Show Gist options
  • Save X0nic/278f8d2e0daf4d1841bf to your computer and use it in GitHub Desktop.
Save X0nic/278f8d2e0daf4d1841bf to your computer and use it in GitHub Desktop.
Vagrantfile loading run_list via json
{
"run_list": [
"recipe[nginx]",
"role[base]"
]
}
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'multi_json'
Vagrant::Config.run do |config|
# Will load nodes/vagrant.json
VAGRANT_JSON = MultiJson.load(Pathname(__FILE__).dirname.join('nodes', 'vagrant.json').read)
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = [ 'cookbooks' , 'site-cookbooks' ]
chef.roles_path = "roles"
chef.log_level = 'debug'
chef.provisioning_path = '/var/chef/cache'
# You may also specify custom JSON attributes:
chef.json = VAGRANT_JSON
VAGRANT_JSON['run_list'].each do |recipe|
chef.add_recipe(recipe)
end if VAGRANT_JSON['run_list']
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment