mirror of
https://codeberg.org/scottslowe/learning-tools.git
synced 2026-03-11 09:04:37 +00:00
Improve consistency across environments
Continue the process of improving consistency across different learning environments to help reduce administrative burden of maintaining environments.
This commit is contained in:
parent
3ab300285e
commit
c5159acd48
2 changed files with 24 additions and 10 deletions
17
debian-generic/Vagrantfile
vendored
17
debian-generic/Vagrantfile
vendored
|
|
@ -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
|
||||
|
|
|
|||
17
ubuntu-generic/Vagrantfile
vendored
17
ubuntu-generic/Vagrantfile
vendored
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue