Shift to nested YAML data files

Edit machines.yml to use nested YAML data structures for box names. Edit Vagrantfile to reference updated YAML data appropriately.

Signed-off-by: Scott S. Lowe <scott.lowe@scottlowe.org>
This commit is contained in:
Scott S. Lowe 2016-11-09 23:35:13 -07:00
parent ba4d123faf
commit 62837642cb
8 changed files with 50 additions and 36 deletions

View file

@ -54,7 +54,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
srv.vm.hostname = machine['name']
# Specify the Vagrant box to use (use VMware box by default)
srv.vm.box = machine['vmw_box']
srv.vm.box = machine['box']['vmw']
# Configure default synced folder (disable by default)
if machine['sync_disabled'] != nil
@ -81,7 +81,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
srv.vm.provider 'virtualbox' do |vb, override|
vb.memory = machine['ram']
vb.cpus = machine['vcpu']
override.vm.box = machine['vb_box']
override.vm.box = machine['box']['vb']
end # srv.vm.provider 'virtualbox'
# Configure VMs with the 'consul' role assigned in machines.yml

View file

@ -1,42 +1,48 @@
---
- name: "consul-01"
vmw_box: "slowe/ubuntu-trusty-x64"
vb_box: "ubuntu/trusty64"
box:
vmw: "slowe/ubuntu-trusty-x64"
vb: "ubuntu/trusty64"
ram: "512"
vcpu: "1"
ip_addr: "192.168.100.101"
role: "consul"
- name: "consul-02"
vmw_box: "slowe/ubuntu-trusty-x64"
vb_box: "ubuntu/trusty64"
box:
vmw: "slowe/ubuntu-trusty-x64"
vb: "ubuntu/trusty64"
ram: "512"
vcpu: "1"
ip_addr: "192.168.100.102"
role: "consul"
- name: "consul-03"
vmw_box: "slowe/ubuntu-trusty-x64"
vb_box: "ubuntu/trusty64"
box:
vmw: "slowe/ubuntu-trusty-x64"
vb: "ubuntu/trusty64"
ram: "512"
vcpu: "1"
ip_addr: "192.168.100.103"
role: "consul"
- name: "docker-01"
vmw_box: "slowe/ubuntu-trusty-x64"
vb_box: "ubuntu/trusty64"
box:
vmw: "slowe/ubuntu-trusty-x64"
vb: "ubuntu/trusty64"
ram: "512"
vcpu: "1"
ip_addr: "192.168.100.104"
role: "docker"
- name: "docker-02"
vmw_box: "slowe/ubuntu-trusty-x64"
vb_box: "ubuntu/trusty64"
box:
vmw: "slowe/ubuntu-trusty-x64"
vb: "ubuntu/trusty64"
ram: "512"
vcpu: "1"
ip_addr: "192.168.100.105"
role: "docker"
- name: "docker-03"
vmw_box: "slowe/ubuntu-trusty-x64"
vb_box: "ubuntu/trusty64"
box:
vmw: "slowe/ubuntu-trusty-x64"
vb: "ubuntu/trusty64"
ram: "512"
vcpu: "1"
ip_addr: "192.168.100.106"

View file

@ -55,7 +55,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
srv.vm.hostname = machine['name']
# Specify the Vagrant box to use (use VMware box by default)
srv.vm.box = machine['vmw_box']
srv.vm.box = machine['box']['vmw']
# Configure default synced folder (disable by default)
if machine['sync_disabled'] != nil
@ -82,7 +82,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
srv.vm.provider 'virtualbox' do |vb, override|
vb.memory = machine['ram']
vb.cpus = machine['vcpu']
override.vm.box = machine['vb_box']
override.vm.box = machine['box']['vb']
end # srv.vm.provider 'virtualbox'
# Configure VMs based on CoreOS box

View file

@ -1,42 +1,48 @@
---
- name: "consul-01"
vmw_box: "slowe/ubuntu-trusty-x64"
vb_box: "ubuntu/trusty64"
box:
vmw: "slowe/ubuntu-trusty-x64"
vb: "ubuntu/trusty64"
ram: "512"
vcpu: "1"
ip_addr: "192.168.1.101"
role: "consul"
- name: "consul-02"
vmw_box: "slowe/ubuntu-trusty-x64"
vb_box: "ubuntu/trusty64"
box:
vmw: "slowe/ubuntu-trusty-x64"
vb: "ubuntu/trusty64"
ram: "512"
vcpu: "1"
ip_addr: "192.168.1.102"
role: "consul"
- name: "consul-03"
vmw_box: "slowe/ubuntu-trusty-x64"
vb_box: "ubuntu/trusty64"
box:
vmw: "slowe/ubuntu-trusty-x64"
vb: "ubuntu/trusty64"
ram: "512"
vcpu: "1"
ip_addr: "192.168.1.103"
role: "consul"
- name: "coreos-01"
vmw_box: "coreos-stable"
vb_box: "coreos-stable"
box:
vmw: "coreos-stable"
vb: "coreos-stable"
ram: "512"
vcpu: "1"
ip_addr: "192.168.1.104"
role: "docker"
- name: "coreos-02"
vmw_box: "coreos-stable"
vb_box: "coreos-stable"
box:
vmw: "coreos-stable"
vb: "coreos-stable"
ram: "512"
vcpu: "1"
ip_addr: "192.168.1.105"
role: "docker"
- name: "coreos-03"
vmw_box: "coreos-stable"
vb_box: "coreos-stable"
box:
vmw: "coreos-stable"
vb: "coreos-stable"
ram: "512"
vcpu: "1"
ip_addr: "192.168.1.106"

View file

@ -31,7 +31,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
srv.vm.hostname = machine['name']
# Specify the Vagrant box to use (use VMware box by default)
srv.vm.box = machine['vmw_box']
srv.vm.box = machine['box']['vmw']
# Configure default synced folder (disable by default)
if machine['sync_disabled'] != nil
@ -58,7 +58,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
srv.vm.provider 'virtualbox' do |vb, override|
vb.memory = machine['ram']
vb.cpus = machine['vcpu']
override.vm.box = machine['vb_box']
override.vm.box = machine['box']['vb']
end # srv.vm.provider 'virtualbox'
end # config.vm.define

View file

@ -1,6 +1,7 @@
---
- name: "photon-01"
vmw_box: "vmware/photon"
vb_box: "vmware/photon"
box:
vmw: "vmware/photon"
vb: "vmware/photon"
ram: "512"
vcpu: "1"

4
photon/Vagrantfile vendored
View file

@ -31,7 +31,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
srv.vm.hostname = machine['name']
# Specify the Vagrant box to use (use VMware box by default)
srv.vm.box = machine['vmw_box']
srv.vm.box = machine['box']['vmw']
# Configure default synced folder (disable by default)
if machine['sync_disabled'] != nil
@ -58,7 +58,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
srv.vm.provider 'virtualbox' do |vb, override|
vb.memory = machine['ram']
vb.cpus = machine['vcpu']
override.vm.box = machine['vb_box']
override.vm.box = machine['box']['vb']
end # srv.vm.provider 'virtualbox'
end # config.vm.define
end # machines.each

View file

@ -1,6 +1,7 @@
---
- name: "photon-01"
vmw_box: "vmware/photon"
vb_box: "vmware/photon"
box:
vmw: "vmware/photon"
vb: "vmware/photon"
ram: "512"
vcpu: "1"