From ba4d123fafef92e6aa4eca0b5434d4af1c32f5c4 Mon Sep 17 00:00:00 2001 From: "Scott S. Lowe" Date: Wed, 9 Nov 2016 23:24:47 -0700 Subject: [PATCH] Shift to nested YAML data files Edit YAML data files to use nested data structures. Edit Vagrantfile to reference YAML data accordingly. Signed-off-by: Scott S. Lowe --- consul-ansible/Vagrantfile | 10 +++++----- consul-ansible/machines.yml | 21 ++++++++++++--------- consul/Vagrantfile | 10 +++++----- consul/machines.yml | 21 ++++++++++++--------- debian-generic/Vagrantfile | 4 ++-- debian-generic/machines.yml | 11 ++++++----- lxc/Vagrantfile | 10 +++++----- lxc/machines.yml | 13 +++++++------ lxd-ansible/Vagrantfile | 10 +++++----- lxd-ansible/machines.yml | 13 +++++++------ ubuntu-generic/Vagrantfile | 4 ++-- ubuntu-generic/machines.yml | 11 ++++++----- 12 files changed, 74 insertions(+), 64 deletions(-) diff --git a/consul-ansible/Vagrantfile b/consul-ansible/Vagrantfile index fc0ca2c..9e9cc4b 100644 --- a/consul-ansible/Vagrantfile +++ b/consul-ansible/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' @@ -32,7 +32,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Don't check for box updates srv.vm.box_check_update = false srv.vm.hostname = machine['name'] - srv.vm.box = machine['vmw_box'] + srv.vm.box = machine['box']['vmw'] # Configure default synced folder (disable by default) if machine['sync_disabled'] != nil @@ -53,14 +53,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 + override.vm.box = machine['box']['vb'] + end # srv.vm.provider 'virtualbox' end # config.vm.define end # machines.each end # Vagrant.configure diff --git a/consul-ansible/machines.yml b/consul-ansible/machines.yml index 43fdb94..11b46ec 100644 --- a/consul-ansible/machines.yml +++ b/consul-ansible/machines.yml @@ -1,19 +1,22 @@ --- - 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 + ip_addr: "192.168.100.101" - 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 + ip_addr: "192.168.100.102" - 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 + ip_addr: "192.168.100.103" diff --git a/consul/Vagrantfile b/consul/Vagrantfile index cb4e327..05e7d5d 100644 --- a/consul/Vagrantfile +++ b/consul/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' @@ -27,7 +27,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Specify hostname and Vagrant box srv.vm.hostname = machine['name'] - srv.vm.box = machine['vmw_box'] + srv.vm.box = machine['box']['vmw'] # Assign an additional static private network srv.vm.network 'private_network', ip: machine['priv_ip'] @@ -46,14 +46,14 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 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) 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 + override.vm.box = machine['box']['vb'] + end # srv.vm.provider 'virtualbox' end # config.vm.define end # machines.each end # Vagrant.configure diff --git a/consul/machines.yml b/consul/machines.yml index 94e2562..c33d189 100644 --- a/consul/machines.yml +++ b/consul/machines.yml @@ -1,19 +1,22 @@ --- - 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" - priv_ip: 192.168.100.101 + priv_ip: "192.168.100.101" - 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" - priv_ip: 192.168.100.102 + priv_ip: "192.168.100.102" - 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" - priv_ip: 192.168.100.103 + priv_ip: "192.168.100.103" diff --git a/debian-generic/Vagrantfile b/debian-generic/Vagrantfile index 17c8ac3..20aecdc 100644 --- a/debian-generic/Vagrantfile +++ b/debian-generic/Vagrantfile @@ -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 diff --git a/debian-generic/machines.yml b/debian-generic/machines.yml index 1c3bbc5..1693e62 100644 --- a/debian-generic/machines.yml +++ b/debian-generic/machines.yml @@ -1,6 +1,7 @@ --- -- name: jessie - vmw_box: slowe/debian-81-x64 - vb_box: debian/jessie64 - ram: 1024 - vcpu: 1 +- name: "jessie" + box: + vmw: "slowe/debian-81-x64" + vb: "debian/jessie64" + ram: "1024" + vcpu: "1" diff --git a/lxc/Vagrantfile b/lxc/Vagrantfile index 89ad1ad..0ba2db7 100644 --- a/lxc/Vagrantfile +++ b/lxc/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' @@ -24,7 +24,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Don't check for box updates srv.vm.box_check_update = false srv.vm.hostname = machine['name'] - srv.vm.box = machine['vmw_box'] + srv.vm.box = machine['box']['vmw'] # Configure default synced folder (disable by default) if machine['sync_disabled'] != nil @@ -45,14 +45,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 + override.vm.box = machine['box']['vb'] + end # srv.vm.provider 'virtualbox' end # config.vm.define # Provision the VM with Ansible diff --git a/lxc/machines.yml b/lxc/machines.yml index 37d924b..3ecb61e 100644 --- a/lxc/machines.yml +++ b/lxc/machines.yml @@ -1,7 +1,8 @@ --- -- name: lxc-01 - vmw_box: slowe/ubuntu-trusty-x64 - vb_box: ubuntu/trusty64 - ram: 512 - vcpu: 1 - ip_addr: 192.168.100.100 +- name: "lxc-01" + box: + vmw: "slowe/ubuntu-trusty-x64" + vb: "ubuntu/trusty64" + ram: "512" + vcpu: "1" + ip_addr: "192.168.100.100" diff --git a/lxd-ansible/Vagrantfile b/lxd-ansible/Vagrantfile index 89ad1ad..0ba2db7 100644 --- a/lxd-ansible/Vagrantfile +++ b/lxd-ansible/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' @@ -24,7 +24,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Don't check for box updates srv.vm.box_check_update = false srv.vm.hostname = machine['name'] - srv.vm.box = machine['vmw_box'] + srv.vm.box = machine['box']['vmw'] # Configure default synced folder (disable by default) if machine['sync_disabled'] != nil @@ -45,14 +45,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 + override.vm.box = machine['box']['vb'] + end # srv.vm.provider 'virtualbox' end # config.vm.define # Provision the VM with Ansible diff --git a/lxd-ansible/machines.yml b/lxd-ansible/machines.yml index 420ac09..0573554 100644 --- a/lxd-ansible/machines.yml +++ b/lxd-ansible/machines.yml @@ -1,7 +1,8 @@ --- -- name: lxd-01 - vmw_box: slowe/ubuntu-trusty-x64 - vb_box: ubuntu/trusty64 - ram: 512 - vcpu: 1 - ip_addr: 192.168.100.100 +- name: "lxd-01" + box: + vmw: "slowe/ubuntu-trusty-x64" + vb: "ubuntu/trusty64" + ram: "512" + vcpu: "1" + ip_addr: "192.168.100.100" diff --git a/ubuntu-generic/Vagrantfile b/ubuntu-generic/Vagrantfile index 17c8ac3..20aecdc 100644 --- a/ubuntu-generic/Vagrantfile +++ b/ubuntu-generic/Vagrantfile @@ -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 diff --git a/ubuntu-generic/machines.yml b/ubuntu-generic/machines.yml index 5d575ef..09bd889 100644 --- a/ubuntu-generic/machines.yml +++ b/ubuntu-generic/machines.yml @@ -1,6 +1,7 @@ --- -- name: trusty - vmw_box: slowe/ubuntu-trusty-x64 - vb_box: ubuntu/trusty64 - ram: 1024 - vcpu: 1 +- name: "trusty" + box: + vmw: "slowe/ubuntu-trusty-x64" + vb: "ubuntu/trusty64" + ram: "1024" + vcpu: "1"