diff --git a/photon/Vagrantfile b/photon/Vagrantfile index d0fb5fa..1864e20 100644 --- a/photon/Vagrantfile +++ b/photon/Vagrantfile @@ -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 diff --git a/photon/servers.yml b/photon/servers.yml index 415a323..fcac26e 100644 --- a/photon/servers.yml +++ b/photon/servers.yml @@ -1,5 +1,5 @@ --- -- name: openstack-cli - box: slowe/ubuntu-trusty-x64 +- name: photon-01 + box: vmware/photon ram: 512 vcpu: 1