Last active
February 2, 2016 15:45
-
-
Save binarytemple/36f7f5796873fbf98494 to your computer and use it in GitHub Desktop.
Vagrantfile which for each file in the directory configs creates and provisions a corresponding host
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ######################################################### | |
| # Usage: | |
| # * Create a sub-directory 'configs' | |
| # * Within that directory: | |
| # ** Create one shell script per-host | |
| # ** Each script must have a '.sh' suffix | |
| # ** The script prefix will correspond with the hostname | |
| ######################################################### | |
| Vagrant.configure(2) do |config| | |
| config.vm.box = "bento/centos-6.7" | |
| Dir.foreach('fetched.configs') do |item| | |
| next if item == '.' or item == '..' | |
| hostname = item.sub(/\.sh$/,"") | |
| config.vm.define hostname do |config| | |
| config.vm.hostname = hostname | |
| config.vm.provider "vmware_fusion" do |v| | |
| v.vmx["memsize"] = 512 | |
| v.vmx["numvcpus"] = 1 | |
| end | |
| config.vm.provision "shell", path:"./fetched.configs/#{item}" | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment