Skip to content

Instantly share code, notes, and snippets.

@scottslowe
Created September 6, 2015 20:56
Show Gist options
  • Save scottslowe/b63e3c14a34bf4b52a9d to your computer and use it in GitHub Desktop.
Save scottslowe/b63e3c14a34bf4b52a9d to your computer and use it in GitHub Desktop.
This is a Vagrantfile being used with Vagrant 1.7.4 and VMware AppCatalyst TP2 that is causing an error when trying to boot a Debian "Jessie" box.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Specify Vagrant version, Vagrant API version, and desired clone location
Vagrant.require_version ">= 1.6.0"
VAGRANTFILE_API_VERSION = "2"
#ENV['VAGRANT_DEFAULT_PROVIDER'] = 'vmware_fusion'
#ENV['VAGRANT_VMWARE_CLONE_DIRECTORY'] = '~/.vagrant'
#ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox'
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'vmware_appcatalyst'
# Require 'yaml' module
require 'yaml'
# Read YAML file with VM details (box, CPU, and RAM)
servers = YAML.load_file('servers.yml')
# Create Ansible inventory file
# (current contents will be overwritten)
f = File.open("hosts","w")
servers.each do |servers|
f.puts servers["ip_addr"]
end # servers.each
f.close
# Create and configure the VMs
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Always use Vagrant's default insecure key
config.ssh.insert_key = false
# Iterate through entries in YAML file to create VMs
servers.each do |servers|
config.vm.define servers["name"] do |srv|
# Don't check for box updates
srv.vm.box_check_update = false
srv.vm.hostname = servers["name"]
srv.vm.box = servers["box"]
# Disable default synced folder
srv.vm.synced_folder ".", "/vagrant", disabled: true
# Assign additional private network
srv.vm.network "private_network", ip: servers["ip_addr"]
# Configure CPU & RAM per settings in servers.yml (Fusion)
srv.vm.provider :vmware_fusion do |vmw|
vmw.vmx["memsize"] = servers["ram"]
vmw.vmx["numvcpus"] = servers["vcpu"]
end # srv.vm.provider vmware_fusion
# Configure CPU & RAM per settings in servers.yml (AppCatalyst)
srv.vm.provider :vmware_appcatalyst do |vmw|
vmw.vmx["memsize"] = servers["ram"]
vmw.vmx["numvcpus"] = servers["vcpu"]
vmw.vmx['guestos'] = "other3xlinux-64"
end # srv.vm.provider vmware_appcatalyst
# Configure CPU & RAM per settings in servers.yml (VirtualBox)
srv.vm.provider :virtualbox do |vb|
vb.memory = servers["ram"]
vb.cpus = servers["vcpu"]
end # srv.vm.provider virtualbox
end # config.vm.define
end # servers.each
end # Vagrant.configure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment