From c5159acd48243723189401c6826e4094a5acd2fe Mon Sep 17 00:00:00 2001 From: "Scott S. Lowe" Date: Wed, 21 Sep 2016 11:09:42 -0600 Subject: [PATCH] Improve consistency across environments Continue the process of improving consistency across different learning environments to help reduce administrative burden of maintaining environments. --- debian-generic/Vagrantfile | 17 ++++++++++++----- ubuntu-generic/Vagrantfile | 17 ++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/debian-generic/Vagrantfile b/debian-generic/Vagrantfile index 3a63f7a..3457e89 100644 --- a/debian-generic/Vagrantfile +++ b/debian-generic/Vagrantfile @@ -1,7 +1,7 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -# Specify Vagrant version, Vagrant API version, and Vagrant clone location +# Specify minimum Vagrant version and Vagrant API version Vagrant.require_version '>= 1.6.0' VAGRANTFILE_API_VERSION = '2' @@ -9,6 +9,7 @@ VAGRANTFILE_API_VERSION = '2' require 'yaml' # Read YAML file with VM details (box, CPU, and RAM) +# Edit machines.yml to change VM configuration details machines = YAML.load_file(File.join(File.dirname(__FILE__), 'machines.yml')) # Create and configure the VMs @@ -19,28 +20,34 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Iterate through entries in YAML file to create VMs machines.each do |machine| + + # Configure the VMs per details in machines.yml config.vm.define machine['name'] do |srv| # Don't check for box updates srv.vm.box_check_update = false + + # Specify the hostname of the VM srv.vm.hostname = machine['name'] + + # Specify the Vagrant box to use (use VMware box by default) srv.vm.box = machine['vmw_box'] # Disable default synced folder srv.vm.synced_folder '.', '/vagrant', disabled: true - # Configure VMs with RAM and CPUs per machines.yml (Fusion) + # Configure CPU & RAM per settings in machines.yml (Fusion) srv.vm.provider 'vmware_fusion' do |vmw| vmw.vmx['memsize'] = machine['ram'] vmw.vmx['numvcpus'] = machine['vcpu'] - end # srv.vm.provider vmware_fusion + end # srv.vm.provider 'vmware_fusion' - # Configure the VM with RAM and CPUs per machines.yml (VirtualBox) + # Configure CPU & RAM per settings in machines.yml (VirtualBox) srv.vm.provider 'virtualbox' do |vb, override| vb.memory = machine['ram'] vb.cpus = machine['vcpu'] override.vm.box = machine['vb_box'] - end # srv.vm.provider virtualbox + end # srv.vm.provider 'virtualbox' end # config.vm.define end # machines.each end # Vagrant.configure diff --git a/ubuntu-generic/Vagrantfile b/ubuntu-generic/Vagrantfile index 2cd73b6..3457e89 100644 --- a/ubuntu-generic/Vagrantfile +++ b/ubuntu-generic/Vagrantfile @@ -1,7 +1,7 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -# Specify Vagrant version, Vagrant API version, and Vagrant clone location +# Specify minimum Vagrant version and Vagrant API version Vagrant.require_version '>= 1.6.0' VAGRANTFILE_API_VERSION = '2' @@ -9,6 +9,7 @@ VAGRANTFILE_API_VERSION = '2' require 'yaml' # Read YAML file with VM details (box, CPU, and RAM) +# Edit machines.yml to change VM configuration details machines = YAML.load_file(File.join(File.dirname(__FILE__), 'machines.yml')) # Create and configure the VMs @@ -19,28 +20,34 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Iterate through entries in YAML file to create VMs machines.each do |machine| + + # Configure the VMs per details in machines.yml config.vm.define machine['name'] do |srv| # Don't check for box updates srv.vm.box_check_update = false + + # Specify the hostname of the VM srv.vm.hostname = machine['name'] + + # Specify the Vagrant box to use (use VMware box by default) srv.vm.box = machine['vmw_box'] # Disable default synced folder srv.vm.synced_folder '.', '/vagrant', disabled: true - # Configure VMs with RAM and CPUs per settings in machines.yml (Fusion) + # Configure CPU & RAM per settings in machines.yml (Fusion) srv.vm.provider 'vmware_fusion' do |vmw| vmw.vmx['memsize'] = machine['ram'] vmw.vmx['numvcpus'] = machine['vcpu'] - end # srv.vm.provider vmware_fusion + end # srv.vm.provider 'vmware_fusion' - # Configure VMs with RAM and CPUs per settings in machines.yml (VirtualBox) + # Configure CPU & RAM per settings in machines.yml (VirtualBox) srv.vm.provider 'virtualbox' do |vb, override| vb.memory = machine['ram'] vb.cpus = machine['vcpu'] override.vm.box = machine['vb_box'] - end # srv.vm.provider virtualbox + end # srv.vm.provider 'virtualbox' end # config.vm.define end # machines.each end # Vagrant.configure