Allow env var REPO_OS to easily switch between platforms

Use a env var instead of manually editing repo files to use
centos.   This also makes it easy for new tools like, test-patch
to switch between the platforms.

Next step will be to allow REPO_DEVICE=  to easily
setup the network interfaces in the multi node cases.

I think env vars are a simple way to handle this, but we could also
consider an user config file ~/openstack-chef-repo.cnf.  Thoughts?

Change-Id: I82e82b35b51e08ff503fdb10fa1ce041c4be4af2
This commit is contained in:
Mark Vanderwiel 2015-04-06 13:56:23 -05:00
parent 02d77a48f9
commit 0390aa9200
9 changed files with 208 additions and 17 deletions

View File

@ -16,11 +16,14 @@ controller_config = <<-ENDCONFIG
config.vm.network "private_network", ip: "172.16.0.254"
ENDCONFIG
env = 'vagrant-aio-neutron'
env = 'vagrant-aio-centos7-neutron' if ENV['REPO_OS'].to_s.include?('centos')
machine 'controller' do
add_machine_options vagrant_config: controller_config
role 'allinone-compute'
role 'os-image-upload'
chef_environment 'vagrant-aio-neutron'
chef_environment env
file('/etc/chef/openstack_data_bag_secret',
"#{File.dirname(__FILE__)}/.chef/encrypted_data_bag_secret")
converge true

View File

@ -17,14 +17,15 @@ controller_config = <<-ENDCONFIG
config.vm.network "private_network", ip: "192.168.100.60"
ENDCONFIG
env = 'vagrant-aio-nova'
env = 'vagrant-aio-centos7-nova' if ENV['REPO_OS'].to_s.include?('centos')
machine 'controller' do
add_machine_options vagrant_config: controller_config
role 'allinone-compute'
role 'os-image-upload'
recipe 'openstack-integration-test::setup'
# if you would like to use centos7 you'll need to
# use 'vagrant-aio-centos7-nova' for the environment
chef_environment 'vagrant-aio-nova'
chef_environment env
file('/etc/chef/openstack_data_bag_secret',
"#{File.dirname(__FILE__)}/.chef/encrypted_data_bag_secret")
converge true

View File

@ -1,3 +1,5 @@
# All in One with Nova networking
The defaults in the aio-nova.rb and the environments/vagrant-aio-nova.json should work without any changes.
Note: Default operating system is ubuntu. If you would like centos, set env var REPO_OS=centos

View File

@ -1,12 +1,14 @@
# Multi node with Nova networking
Note: Default operating system is ubuntu. If you would like centos, set env var REPO_OS=centos
## Nodes
The multi-node environments will have four machines `controller`,`compute1`,`compute2`, and `compute3`.
The multi-node environments will have four machines `controller`, `compute1`, `compute2`, and `compute3`.
## Networking setup
Changes need to be made to the multi-nova.rb and the environments\vagrant-multi-nova.json file.
Changes need to be made to the multi-nova.rb and the environments\vagrant-multi-nova.json or environments\vagrant-multi-centos7-nova.json file.
### Bridge IP Address

View File

@ -0,0 +1,74 @@
{
"name": "vagrant-aio-centos7-neutron",
"description": "Environment used in testing the upstream cookbooks and reference Chef repository with vagrant. To be used with the Vagrantfile-aio-neutron vagrantfile. Defines the necessary attributes for a working all-in-one openstack deployment, using neutron for the networking component, and the openvswitch neutron plugin",
"cookbook_versions": {
},
"json_class": "Chef::Environment",
"chef_type": "environment",
"default_attributes": {
},
"override_attributes": {
"mysql": {
"allow_remote_root": true,
"root_network_acl": ["%"]
},
"openstack": {
"mq": {
"user": "admin"
},
"endpoints": {
"identity-bind": {
"host": "0.0.0.0"
},
"bind-host": "0.0.0.0"
},
"network": {
"service_plugins": [ "neutron.services.l3_router.l3_router_plugin.L3RouterPlugin" ],
"dhcp": {
"enable_isolated_metadata": "True"
},
"openvswitch": {
"tunnel_id_ranges": "1:1000",
"enable_tunneling": "True",
"tunnel_type": "gre",
"tenant_network_type": "gre"
},
"api": {
"bind_interface": "enp0s8"
},
"quota": {
"floatingip": "50"
},
"l3":{
"external_network_bridge_interface": "enp0s8"
}
},
"block-storage": {
"volume": {
"create_volume_group": true,
"default_volume_type": "lvm"
}
},
"image": {
"image_upload": true,
"upload_images": [
"cirros"
],
"upload_image": {
"cirros": "https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img"
}
},
"compute": {
"network": {
"service_type": "neutron"
},
"config": {
"ram_allocation_ratio": 5.0
},
"libvirt": {
"virt_type": "qemu"
}
}
}
}
}

View File

@ -0,0 +1,107 @@
{
"name": "vagrant-multi-neutron",
"description": "Environment used in testing the upstream cookbooks and reference Chef repository with vagrant. To be used with the Vagrantfile-multi-neutron vagrantfile. Defines the necessary attributes for a working mutltinode (1 controller/n computes) openstack deployment, using neutron (with gre tunnels between hosts) for the networking component.",
"cookbook_versions": {
},
"json_class": "Chef::Environment",
"chef_type": "environment",
"default_attributes": {
},
"override_attributes": {
"mysql": {
"allow_remote_root": true,
"root_network_acl": ["%"]
},
"openstack": {
"mq": {
"user": "admin"
},
"identity": {
"bind_interface": "enp0s8"
},
"endpoints": {
"host": "192.168.100.60",
"bind-host": "192.168.100.60",
"mq": {
"host": "192.168.100.60"
},
"db": {
"host": "192.168.100.60"
},
"image-api-bind":{
"host": "192.168.100.60"
},
"image-api":{
"host": "192.168.100.60"
},
"compute-vnc-bind":{
"host": "0.0.0.0",
"bind_interface": "enp0s8"
},
"compute-vnc":{
"host": "0.0.0.0",
"bind_interface": "enp0s8"
}
},
"network": {
"service_plugins": [ "neutron.services.l3_router.l3_router_plugin.L3RouterPlugin" ],
"dhcp": {
"enable_isolated_metadata": "True"
},
"openvswitch": {
"tunnel_id_ranges": "1:1000",
"enable_tunneling": "True",
"tunnel_type": "gre",
"tenant_network_type": "gre"
},
"api": {
"bind_interface": "enp0s8"
},
"quota": {
"floatingip": "50"
},
"l3":{
"external_network_bridge_interface": "enp0s8"
}
},
"block-storage": {
"volume": {
"create_volume_group": true,
"default_volume_type": "lvm"
}
},
"image": {
"api": {
"bind_interface": "enp0s8"
},
"registry": {
"bind_interface": "enp0s8"
},
"image_upload": true,
"upload_images": [
"cirros"
],
"upload_image": {
"cirros": "https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img"
}
},
"compute": {
"enabled_apis": "ec2,osapi_compute",
"novnc_proxy": {
"bind_interface": "enp0s8",
"bind_address": "0.0.0.0"
},
"libvirt": {
"virt_type": "qemu"
},
"network": {
"public_interface": "enp0s8",
"service_type": "neutron"
},
"config": {
"ram_allocation_ratio": 5.0
}
}
}
}
}

View File

@ -18,6 +18,9 @@ controller_config = <<-ENDCONFIG
config.vm.network "private_network", ip: "192.168.200.60"
ENDCONFIG
env = 'vagrant-multi-neutron'
env = 'vagrant-multi-centos7-neutron' if ENV['REPO_OS'].to_s.include?('centos')
machine 'controller' do
add_machine_options vagrant_config: controller_config
role 'os-compute-single-controller-no-network'
@ -28,7 +31,7 @@ machine 'controller' do
role 'os-network-server'
recipe 'openstack-common::openrc'
recipe 'openstack-common::client'
chef_environment 'vagrant-multi-neutron'
chef_environment env
file('/etc/chef/openstack_data_bag_secret',
"#{File.dirname(__FILE__)}/.chef/encrypted_data_bag_secret")
converge true
@ -49,7 +52,7 @@ config.vm.network "private_network", ip: "192.168.100.#{ip_suff}"
config.vm.network "private_network", ip: "192.168.200.#{ip_suff}"
ENDCONFIG
role 'os-compute-worker'
chef_environment 'vagrant-multi-neutron'
chef_environment env
file('/etc/chef/openstack_data_bag_secret',
"#{File.dirname(__FILE__)}/.chef/encrypted_data_bag_secret")
converge true

View File

@ -19,15 +19,16 @@ controller_config = <<-ENDCONFIG
bridge: '<put your interface device name here>'
ENDCONFIG
env = 'vagrant-aio-nova'
env = 'vagrant-aio-centos7-nova' if ENV['REPO_OS'].to_s.include?('centos')
machine 'controller' do
add_machine_options vagrant_config: controller_config
role 'os-compute-single-controller'
recipe 'openstack-common::openrc'
recipe 'openstack-common::client'
recipe 'openstack-integration-test::setup'
# if you would like to use centos7 you'll need to
# use 'vagrant-multi-centos7-nova' for the environment
chef_environment 'vagrant-multi-nova'
chef_environment env
file('/etc/chef/openstack_data_bag_secret',
"#{File.dirname(__FILE__)}/.chef/encrypted_data_bag_secret")
converge true
@ -48,9 +49,7 @@ config.vm.network "public_network", ip: "172.16.100.#{ip_suff}",
bridge: '<put your interface device name here>'
ENDCONFIG
role 'os-compute-worker'
# if you would like to use centos7 you'll need to
# use 'vagrant-multi-centos7-nova' for the environment
chef_environment 'vagrant-multi-nova'
chef_environment env
file('/etc/chef/openstack_data_bag_secret',
"#{File.dirname(__FILE__)}/.chef/encrypted_data_bag_secret")
converge true

View File

@ -8,9 +8,9 @@ vagrant_box 'ubuntu14' do
url 'http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box'
end
os = ENV['REPO_OS'] || 'ubuntu14'
with_driver "vagrant:#{File.dirname(__FILE__)}/vms"
with_machine_options vagrant_options: {
# if you would like to use centos7 you'll need to
# update the chef_environment in the main recipe files (aio or multi _nova)
'vm.box' => 'ubuntu14'
'vm.box' => os
}