Add vagrantfile/environment for a working vagrant all-in-one using

nova-network

Implements: blueprint reference-havana-vagrant

- remove unused attrs from previous example vagrant.rb, and change to
  vagrant-aio-nova.json
- add Vagrantfile-aio-nova targeted specifically at an allinone using
  nova-network (other vagrantfiles can cover other deployments)
- Update CentOS box to 6.5
- Remove Vagrantfile and environments/vagrant.rb to avoid confusion
- allow multiple simultaneous vagrant up with different chef-zero
  servers
- add usage comments at top of file

Change-Id: I9e4145dd1f22efa7e423794bb122bde756884f40
This commit is contained in:
Darren Birkett
2014-01-27 15:14:13 +00:00
parent 38d75ff55d
commit a7979b25d1
4 changed files with 149 additions and 115 deletions

57
Vagrantfile vendored
View File

@@ -1,57 +0,0 @@
Vagrant.require_plugin "vagrant-berkshelf"
Vagrant.require_plugin "vagrant-chef-zero"
Vagrant.require_plugin "vagrant-omnibus"
Vagrant.configure("2") do |config|
# Berkshelf plugin configuration
config.berkshelf.enabled = true
# Chef-Zero plugin configuration
config.chef_zero.enabled = true
config.chef_zero.chef_repo_path = "."
# Omnibus plugin configuration
config.omnibus.chef_version = :latest
# Port forwarding rules, for access to openstack services
config.vm.network "forwarded_port", guest: 443, host: 8443 # dashboard-ssl
config.vm.network "forwarded_port", guest: 4000, host: 4000 # chef-zero
config.vm.network "forwarded_port", guest: 8773, host: 8773 # compute-ec2-api
config.vm.network "forwarded_port", guest: 8774, host: 8774 # compute-api
# OpenStack-related settings
config.vm.network "private_network", ip: "33.33.33.60"
config.vm.network "private_network", ip: "192.168.100.60"
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--cpus", 2]
vb.customize ["modifyvm", :id, "--memory", 2048]
vb.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
end
chef_environment = "vagrant"
chef_run_list = [ "role[allinone-compute]" ]
# Ubuntu 12.04 Config
config.vm.define :ubuntu1204 do |ubuntu1204|
ubuntu1204.vm.hostname = "ubuntu1204"
ubuntu1204.vm.box = "opscode-ubuntu-12.04"
ubuntu1204.vm.box_url = "https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box"
ubuntu1204.vm.provision :chef_client do |chef|
chef.environment = chef_environment
chef.run_list = chef_run_list.unshift("recipe[apt::cacher-client]")
end
end
# Centos 6.4 Config
config.vm.define :centos64 do |centos64|
centos64.vm.hostname = "centos64"
centos64.vm.box = "opscode-centos-6.4"
centos64.vm.box_url = "https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box"
centos64.vm.provision :chef_client do |chef|
chef.environment = chef_environment
chef.run_list = chef_run_list
end
end
end

101
Vagrantfile-aio-nova Normal file
View File

@@ -0,0 +1,101 @@
# to use this vagrantfile, do either one of the following (not both):
# 1) export VAGRANT_VAGRANTFILE=Vagrantfile-aio-nova
# 2) mv Vagrantfile-aio-nova Vagrantfile
#
# and then use as normal:
# vagrant up centos65
# AND/OR
# vagrant up ubuntu1204
Vagrant.require_version ">= 1.1"
Vagrant.require_plugin "vagrant-berkshelf"
Vagrant.require_plugin "vagrant-chef-zero"
Vagrant.require_plugin "vagrant-omnibus"
Vagrant.configure("2") do |config|
# Berkshelf plugin configuration
config.berkshelf.enabled = true
# Chef-Zero plugin configuration
config.chef_zero.enabled = true
config.chef_zero.chef_repo_path = "."
# Omnibus plugin configuration
config.omnibus.chef_version = :latest
# get local ip so that we can force chef zero onto a different port per
# machine, allowing for multiple simultaneous vagrant up runs
local_ip = Socket.ip_address_list.detect{|intf| intf.ipv4_private?}.ip_address
# OpenStack-related settings
config.vm.network "private_network", ip: "192.168.100.60"
chef_environment = "vagrant-aio-nova"
chef_run_list = [ "role[allinone-compute]","role[os-image-upload]" ]
# virtualbox provider settings
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--cpus", 2]
vb.customize ["modifyvm", :id, "--memory", 2048]
vb.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
end
#######################
# Ubuntu 12.04 #
#######################
config.vm.define :ubuntu1204 do |ubuntu1204|
ubuntu1204.vm.hostname = "ubuntu1204"
ubuntu1204.vm.box = "opscode-ubuntu-12.04"
ubuntu1204.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.04_chef-provisionerless.box"
ubuntu1204.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
ubuntu1204.vm.network "forwarded_port", guest: 443, host: 8443 # dashboard-ssl
ubuntu1204.vm.network "forwarded_port", guest: 8773, host: 8773 # compute-ec2-api
ubuntu1204.vm.network "forwarded_port", guest: 8774, host: 8774 # compute-api
ubuntu1204.vm.network "forwarded_port", guest: 4002, host: 4002 # chef-zero
ubuntu1204.vm.provision :chef_client do |chef|
chef.environment = chef_environment
chef.run_list = chef_run_list.unshift("recipe[apt::cacher-client]")
chef.chef_server_url = "http://#{local_ip}:4002"
end
end
#######################
# Centos 6.5 #
#######################
config.vm.define :centos65 do |centos65|
centos65.vm.hostname = "centos65"
centos65.vm.box = "opscode-centos-6.5"
centos65.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5_chef-provisionerless.box"
centos65.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
centos65.vm.network "forwarded_port", guest: 443, host: 9443 # dashboard-ssl
centos65.vm.network "forwarded_port", guest: 8773, host: 9773 # compute-ec2-api
centos65.vm.network "forwarded_port", guest: 8774, host: 9774 # compute-api
centos65.vm.network "forwarded_port", guest: 4001, host: 4001 # chef-zero
centos65.vm.provision :chef_client do |chef|
chef.environment = chef_environment
chef.run_list = chef_run_list
chef.chef_server_url = "http://#{local_ip}:4001"
end
end
end

View File

@@ -0,0 +1,48 @@
{
"name": "vagrant-aio-nova",
"description": "Environment used in testing the upstream cookbooks and reference Chef repository with vagrant. To be used with the Vagrantfile-aio-nova vagrantfile. Defines the necessary attributes for a working all-in-one openstack deployment, using nova-network for the networking component",
"cookbook_versions": {
},
"json_class": "Chef::Environment",
"chef_type": "environment",
"default_attributes": {
},
"override_attributes": {
"openstack": {
"developer_mode": true,
"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": {
"public_interface": "eth1",
"service_type": "nova"
},
"config": {
"ram_allocation_ratio": 5.0
},
"libvirt": {
"virt_type": "qemu"
},
"networks": [
{
"label": "public",
"ipv4_cidr": "192.168.100.0/24",
"num_networks": "1",
"network_size": "255",
"bridge": "br100",
"bridge_dev": "eth1",
"dns1": "8.8.8.8",
"dns2": "8.8.4.4"
}
]
}
}
}
}

View File

@@ -1,58 +0,0 @@
name "vagrant"
description "Environment used in testing with Vagrant the upstream cookbooks and reference Chef repository. Defines the network and database settings to use with OpenStack. The networks will be used in the libraries provided by the osops-utils cookbook. This example is for FlatDHCP with 2 physical networks."
override_attributes(
"mysql" => {
"allow_remote_root" => true,
"root_network_acl" => "%"
},
"openstack" => {
"developer_mode" => true,
"identity" => {
"catalog" => {
"backend" => "templated"
},
},
"image" => {
"upload_images" => ["cirros"],
"upload_image" => {
"cirros" => "https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img"
},
"identity_service_chef_role" => "allinone-compute"
},
"block-storage" => {
"keystone_service_chef_role" => "allinone-compute"
},
"dashboard" => {
"keystone_service_chef_role" => "allinone-compute"
},
"network" => {
"rabbit_server_chef_role" => "allinone-compute"
},
"compute" => {
"identity_service_chef_role" => "allinone-compute",
"network" => {
"fixed_range" => "192.168.100.0/24",
"public_interface" => "eth2"
},
"config" => {
"ram_allocation_ratio" => 5.0
},
"libvirt" => {
"virt_type" => "qemu"
},
"networks" => [
{
"label" => "public",
"ipv4_cidr" => "192.168.100.0/24",
"num_networks" => "1",
"network_size" => "255",
"bridge" => "br100",
"bridge_dev" => "eth2",
"dns1" => "8.8.8.8",
"dns2" => "8.8.4.4"
}
]
}
}
)