diff --git a/docker-ipvlan/Vagrantfile b/docker-ipvlan/Vagrantfile index 3264809..180f6e1 100644 --- a/docker-ipvlan/Vagrantfile +++ b/docker-ipvlan/Vagrantfile @@ -1,7 +1,7 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -# Specify Vagrant version, Vagrant API version, and desired 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, RAM, IP addresses) +# 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,11 +20,17 @@ 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'] # Configure default synced folder (disable by default) @@ -35,7 +42,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Assign additional private network per settings in machines.yml if machine['priv_ip'] == true - srv.vm.network 'private_network', auto_config: false + srv.vm.network 'private_network', ip: '169.254.100.200', auto_config: false end # if machine['ip_addr'] # Configure CPU & RAM per settings in machines.yml (Fusion) @@ -45,14 +52,14 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| if machine['nested'] == true vmw.vmx['vhv.enable'] = 'TRUE' end #if machine['nested'] - end # srv.vm.provider vmware_fusion + end # srv.vm.provider 'vmware_fusion' # 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' # Provision 'docker-01' if machine['name'] == 'docker-01' diff --git a/docker-ipvlan/docker-provision.sh b/docker-ipvlan/docker-provision.sh index aa2f161..92a62b3 100644 --- a/docker-ipvlan/docker-provision.sh +++ b/docker-ipvlan/docker-provision.sh @@ -1,8 +1,8 @@ #!/bin/bash # Provision secondary network interface -sudo ip addr add 192.168.100.100/24 dev ens33 -sudo ip link set ens33 up +sudo ip addr add 192.168.100.100/24 dev eth1 +sudo ip link set eth1 up # Install curl if needed if [[ ! -e /usr/bin/curl ]]; then diff --git a/docker-ipvlan/machines.yml b/docker-ipvlan/machines.yml index 1df604d..4a6315a 100644 --- a/docker-ipvlan/machines.yml +++ b/docker-ipvlan/machines.yml @@ -1,15 +1,15 @@ --- -- name: docker-01 - vmw_box: slowe/ubuntu-15.10-server-amd64 - vb_box: ubuntu/wily64 - ram: 1024 - vcpu: 1 +- name: "docker-01" + vmw_box: "slowe/ubuntu-15.10-server-amd64" + vb_box: "ubuntu/wily64" + ram: "1024" + vcpu: "1" priv_ip: true docker: true -- name: remote-01 - vmw_box: slowe/ubuntu-trusty-x64 - vb_box: ubuntu/trusty64 - ram: 512 - vcpu: 1 +- name: "remote-01" + vmw_box: "slowe/ubuntu-trusty-x64" + vb_box: "ubuntu/trusty64" + ram: "512" + vcpu: "1" priv_ip: true docker: false