Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yaml integration #447

Open
tlartaud opened this issue Feb 28, 2015 · 2 comments
Open

Yaml integration #447

tlartaud opened this issue Feb 28, 2015 · 2 comments

Comments

@tlartaud
Copy link

Hi there !

I really like your provisionner scripts, thanks for sharing.
It could be great to implement some yaml files configuration instead of needing to edit the vagrantfile.
There is a a great example on Cakebox.

So, the main Vagrant file could look something like this :

# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = '2'

# Config Github Settings
github_username = "fideloper"
github_repo     = "Vaprobash"
github_branch   = "1.3.1"
github_url      = "https://raw.githubusercontent.com/#{github_username}/#{github_repo}/#{github_branch}"

path = "#{File.dirname(__FILE__)}"
require github_url + '/scripts/Vagrantfile.rb'
require 'yaml'

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  raise Vagrant::Errors::VagrantError.new, 'Fatal: your Vaprobash.yaml is missing' unless File.exist?(path + '/Vaprobash.yaml')
  Vaprobash.configure(config, YAML::load(File.read(path + '/Vaprobash.yaml')))
end

So you can keep using your curl command to download the main vagrant file, and it allow the user to have two choices :

  • use require github_url + '/scripts/Vagrantfile.rb' so the user will not only use the last scripts, but also the last vagrantfile.
  • use require path + '/scripts/Vagrantfile.rb' so the user can use his own copy of vagrantfile locally (would maybe require initilisation via git clone instead of curl)

What do you think ?

@fideloper
Copy link
Owner

Definitely interesting! I've been really busy lately, but I'll give this more attention in the near future.

Thanks!

@n3r0-ch
Copy link
Contributor

n3r0-ch commented Nov 8, 2015

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants