Update Vagrantfile, add servers.yml

Add servers.yml for VM configuration details. Update Vagrantfile to
reference servers.yml for configuration. Add more comments to
Vagrantfile.
This commit is contained in:
Scott Lowe 2015-04-20 21:50:37 -06:00
parent 86c4918c85
commit fe339b7d0a
2 changed files with 35 additions and 11 deletions

42
photon/Vagrantfile vendored
View file

@ -5,18 +5,42 @@
Vagrant.require_version ">= 1.6.0"
VAGRANTFILE_API_VERSION = "2"
# Require 'yaml' module
require 'yaml'
# Read YAML file to get VM configuration information
# Edit servers.yml to change VM configuration details
servers = YAML.load_file('servers.yml')
# Create and configure the VMs
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Specify the Vagrant box to use
config.vm.box = "vmware/photon"
# Disable automatic box update checking
config.vm.box_check_update = false
# Use Vagrant's default insecure SSH key
config.ssh.insert_key = false
# Disable default synced folder
config.vm.synced_folder ".", "/vagrant", disabled: true
end
# Iterate through entries in YAML file to create VMs
servers.each do |servers|
# Configure the VMs per details in servers.yml
config.vm.define servers["name"] do |srv|
# Don't check for box updates
srv.vm.box_check_update = false
# Specify the hostname of the VM
srv.vm.hostname = servers["name"]
# Specify the Vagrant box to use
srv.vm.box = servers["box"]
# Disable default synced folder (not supported with Photon)
srv.vm.synced_folder ".", "/vagrant", disabled: true
# Configure VMs with RAM and CPUs per settings in servers.yml
srv.vm.provider :vmware_fusion do |vmw|
vmw.vmx["memsize"] = servers["ram"]
vmw.vmx["numvcpus"] = servers["vcpu"]
end # srv.vm.provider
end # config.vm.define
end # servers.each
end # Vagrant.configure

View file

@ -1,5 +1,5 @@
---
- name: openstack-cli
box: slowe/ubuntu-trusty-x64
- name: photon-01
box: vmware/photon
ram: 512
vcpu: 1