Refactored provisioning cookbook for Ocata, ChefDK updates
- changed to a more alive fork of statsd, as att-cloud/statsd has been stale for years - renamed multi-node to multinode to be consistent with OpenStack naming conventions - introduced network node in the multinode scenario - bumped mysql2 to 0.4.5 to align with upstream - removed nova cell setup helper since it is no longer needed Change-Id: If4d4d45981c8895ca57cba9c34fa1eea4b8871e3 Depends-On: I950605f384405b55737af77bc4224f1e18fee8e1 Depends-On: I4c26aea78220eb20fc4e5e964af93414855df5f6 Depends-On: I3112615cec3dd80c63779d164893b4171773856c Depends-On: I97b453fc419bfbf01679dadf39a256b1f0f99859 Depends-On: Iba9ba7110dfde7635edc6706ecbbafbdbb161002 Depends-On: Ie1d5f27a9cf8803044568a31e4dae7654b02c9a1 Depends-On: I7c2950270f88cc9d54de593460009c6741913796 Depends-On: I16d6f892f325a80eb3eabd10110177246b63663f Depends-On: Ie61ae3ca685738fe1de98fc9223d3e39535ce000 Depends-On: I63e6680cec8b66e2ece2d2627c0b413f5d401317
This commit is contained in:
parent
887f82636d
commit
2873826b76
@ -1,3 +1,5 @@
|
|||||||
|
inherit_from: .rubocop_todo.yml
|
||||||
|
|
||||||
AllCops:
|
AllCops:
|
||||||
Include:
|
Include:
|
||||||
- '**/*.rb'
|
- '**/*.rb'
|
||||||
|
12
.rubocop_todo.yml
Normal file
12
.rubocop_todo.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# This configuration was generated by
|
||||||
|
# `rubocop --auto-gen-config`
|
||||||
|
# on 2017-08-02 14:33:46 -0400 using RuboCop version 0.47.1.
|
||||||
|
# The point is for the user to remove these configuration records
|
||||||
|
# one by one as the offenses are removed from the code base.
|
||||||
|
# Note that changes in the inspected code, or installation of new
|
||||||
|
# versions of RuboCop, may require this file to be generated again.
|
||||||
|
|
||||||
|
# Offense count: 2
|
||||||
|
# Configuration parameters: CountComments, ExcludedMethods.
|
||||||
|
Metrics/BlockLength:
|
||||||
|
Max: 33
|
@ -23,4 +23,4 @@ source 'https://supermarket.chef.io'
|
|||||||
end
|
end
|
||||||
|
|
||||||
cookbook 'openstackclient', github: 'cloudbau/cookbook-openstackclient'
|
cookbook 'openstackclient', github: 'cloudbau/cookbook-openstackclient'
|
||||||
cookbook 'statsd', github: 'att-cloud/cookbook-statsd'
|
cookbook 'statsd', github: 'librato/statsd-cookbook'
|
||||||
|
26
Rakefile
26
Rakefile
@ -39,12 +39,12 @@ end
|
|||||||
|
|
||||||
desc "All-in-One build"
|
desc "All-in-One build"
|
||||||
task :allinone => :create_key do
|
task :allinone => :create_key do
|
||||||
run_command("chef-client #{client_opts} -o 'provisioning::vagrant_linux,provisioning::allinone'")
|
run_command("chef-client #{client_opts} -o 'provisioning::allinone'")
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Multi-Node build"
|
desc "Multinode build"
|
||||||
task :multi_node => :create_key do
|
task :multinode => :create_key do
|
||||||
run_command("chef-client #{client_opts} -o 'provisioning::vagrant_linux,provisioning::multi-node'")
|
run_command("chef-client #{client_opts} -o 'provisioning::multinode'")
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Blow everything away"
|
desc "Blow everything away"
|
||||||
@ -164,19 +164,6 @@ def _setup_local_network # rubocop:disable Metrics/MethodLength
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Helper for setting up nova cells
|
|
||||||
def _setup_nova_cells # rubocop:disable Metrics/MethodLength
|
|
||||||
_run_commands('nova cells setup', {
|
|
||||||
'nova-manage cell_v2' => ['list_cells',
|
|
||||||
'map_cell0 --database_connection mysql+pymysql://nova_cell0:mypass@127.0.0.1/nova_cell0?charset=utf8',
|
|
||||||
'create_cell --verbose --name cell1',
|
|
||||||
'discover_hosts',
|
|
||||||
'list_cells'
|
|
||||||
],
|
|
||||||
'nova-manage' => ['db sync'] }
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Helper for setting up tempest and upload the default cirros image.
|
# Helper for setting up tempest and upload the default cirros image.
|
||||||
def _setup_tempest(client_opts)
|
def _setup_tempest(client_opts)
|
||||||
sh %(sudo chef-client #{client_opts} -E integration-#{@platform} -r 'recipe[openstack-integration-test::setup]')
|
sh %(sudo chef-client #{client_opts} -E integration-#{@platform} -r 'recipe[openstack-integration-test::setup]')
|
||||||
@ -199,9 +186,9 @@ task :integration => [:create_key, :berks_vendor] do
|
|||||||
_run_env_queries
|
_run_env_queries
|
||||||
|
|
||||||
# Install mysql2 gem to avoid hitting mirror issues
|
# Install mysql2 gem to avoid hitting mirror issues
|
||||||
sh %(wget https://rubygems.org/downloads/mysql2-0.4.4.gem)
|
sh %(wget https://rubygems.org/downloads/mysql2-0.4.5.gem)
|
||||||
sh %(sudo apt-get install -y libmysqlclient-dev)
|
sh %(sudo apt-get install -y libmysqlclient-dev)
|
||||||
sh %(chef exec gem install -N ./mysql2-0.4.4.gem)
|
sh %(chef exec gem install -N ./mysql2-0.4.5.gem)
|
||||||
|
|
||||||
# Three passes to make sure of cookbooks idempotency
|
# Three passes to make sure of cookbooks idempotency
|
||||||
for i in 1..3
|
for i in 1..3
|
||||||
@ -210,7 +197,6 @@ task :integration => [:create_key, :berks_vendor] do
|
|||||||
# Kick off chef client in local mode, will converge OpenStack right on the gate job "in place"
|
# Kick off chef client in local mode, will converge OpenStack right on the gate job "in place"
|
||||||
sh %(sudo chef-client #{client_opts} -E integration-#{@platform} -r 'role[minimal]')
|
sh %(sudo chef-client #{client_opts} -E integration-#{@platform} -r 'role[minimal]')
|
||||||
if i == 1
|
if i == 1
|
||||||
_setup_nova_cells
|
|
||||||
_setup_tempest(client_opts)
|
_setup_tempest(client_opts)
|
||||||
_setup_local_network
|
_setup_local_network
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "multi-node-centos7",
|
"name": "multinode-centos7",
|
||||||
"cookbook_versions": {
|
"cookbook_versions": {
|
||||||
},
|
},
|
||||||
"json_class": "Chef::Environment",
|
"json_class": "Chef::Environment",
|
||||||
@ -30,7 +30,8 @@
|
|||||||
"compute-novnc": { "host": "192.168.101.60" },
|
"compute-novnc": { "host": "192.168.101.60" },
|
||||||
"orchestration-api": { "host": "192.168.101.60" },
|
"orchestration-api": { "host": "192.168.101.60" },
|
||||||
"orchestration-api-cfn": { "host": "192.168.101.60" },
|
"orchestration-api-cfn": { "host": "192.168.101.60" },
|
||||||
"orchestration-api-cloudwatch": { "host": "192.168.101.60" }
|
"orchestration-api-cloudwatch": { "host": "192.168.101.60" },
|
||||||
|
"placement-api": { "host": "192.168.101.60" }
|
||||||
},
|
},
|
||||||
"internal": {
|
"internal": {
|
||||||
"identity": { "host": "192.168.101.60" },
|
"identity": { "host": "192.168.101.60" },
|
||||||
@ -43,7 +44,8 @@
|
|||||||
"compute-novnc": { "host": "192.168.101.60" },
|
"compute-novnc": { "host": "192.168.101.60" },
|
||||||
"orchestration-api": { "host": "192.168.101.60" },
|
"orchestration-api": { "host": "192.168.101.60" },
|
||||||
"orchestration-api-cfn": { "host": "192.168.101.60" },
|
"orchestration-api-cfn": { "host": "192.168.101.60" },
|
||||||
"orchestration-api-cloudwatch": { "host": "192.168.101.60" }
|
"orchestration-api-cloudwatch": { "host": "192.168.101.60" },
|
||||||
|
"placement-api": { "host": "192.168.101.60" }
|
||||||
},
|
},
|
||||||
"public": {
|
"public": {
|
||||||
"identity": { "host": "192.168.101.60" },
|
"identity": { "host": "192.168.101.60" },
|
||||||
@ -56,9 +58,11 @@
|
|||||||
"compute-novnc": { "host": "192.168.101.60" },
|
"compute-novnc": { "host": "192.168.101.60" },
|
||||||
"orchestration-api": { "host": "192.168.101.60" },
|
"orchestration-api": { "host": "192.168.101.60" },
|
||||||
"orchestration-api-cfn": { "host": "192.168.101.60" },
|
"orchestration-api-cfn": { "host": "192.168.101.60" },
|
||||||
"orchestration-api-cloudwatch": { "host": "192.168.101.60" }
|
"orchestration-api-cloudwatch": { "host": "192.168.101.60" },
|
||||||
|
"placement-api": { "host": "192.168.101.60" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"bind_interface": "enp0s8",
|
||||||
"bind_service": {
|
"bind_service": {
|
||||||
"mq": { "host": "192.168.101.60" },
|
"mq": { "host": "192.168.101.60" },
|
||||||
"main": {
|
"main": {
|
||||||
@ -77,7 +81,8 @@
|
|||||||
"compute-novnc": { "host": "0.0.0.0" },
|
"compute-novnc": { "host": "0.0.0.0" },
|
||||||
"orchestration-api": { "host": "0.0.0.0" },
|
"orchestration-api": { "host": "0.0.0.0" },
|
||||||
"orchestration-api-cfn": { "host": "0.0.0.0" },
|
"orchestration-api-cfn": { "host": "0.0.0.0" },
|
||||||
"orchestration-api-cloudwatch": { "host": "0.0.0.0" }
|
"orchestration-api-cloudwatch": { "host": "0.0.0.0" },
|
||||||
|
"placement-api": { "host": "0.0.0.0" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dashboard": {
|
"dashboard": {
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "multi-node-ubuntu16",
|
"name": "multinode-ubuntu16",
|
||||||
"cookbook_versions": {
|
"cookbook_versions": {
|
||||||
},
|
},
|
||||||
"json_class": "Chef::Environment",
|
"json_class": "Chef::Environment",
|
||||||
@ -15,12 +15,16 @@
|
|||||||
"override_attributes": {
|
"override_attributes": {
|
||||||
"openstack": {
|
"openstack": {
|
||||||
"apt": {
|
"apt": {
|
||||||
|
"unattended_upgrades": {
|
||||||
|
"enable": false
|
||||||
|
},
|
||||||
"update_apt_cache": true
|
"update_apt_cache": true
|
||||||
},
|
},
|
||||||
"sysctl": {
|
"sysctl": {
|
||||||
"net.ipv4.ip_forward": 1
|
"net.ipv4.ip_forward": 1
|
||||||
},
|
},
|
||||||
"endpoints": {
|
"endpoints": {
|
||||||
|
"db": { "host": "192.168.101.60" },
|
||||||
"mq": { "host": "192.168.101.60" },
|
"mq": { "host": "192.168.101.60" },
|
||||||
"admin": {
|
"admin": {
|
||||||
"identity": { "host": "192.168.101.60" },
|
"identity": { "host": "192.168.101.60" },
|
||||||
@ -33,7 +37,8 @@
|
|||||||
"compute-novnc": { "host": "192.168.101.60" },
|
"compute-novnc": { "host": "192.168.101.60" },
|
||||||
"orchestration-api": { "host": "192.168.101.60" },
|
"orchestration-api": { "host": "192.168.101.60" },
|
||||||
"orchestration-api-cfn": { "host": "192.168.101.60" },
|
"orchestration-api-cfn": { "host": "192.168.101.60" },
|
||||||
"orchestration-api-cloudwatch": { "host": "192.168.101.60" }
|
"orchestration-api-cloudwatch": { "host": "192.168.101.60" },
|
||||||
|
"placement-api": { "host": "192.168.101.60" }
|
||||||
},
|
},
|
||||||
"internal": {
|
"internal": {
|
||||||
"identity": { "host": "192.168.101.60" },
|
"identity": { "host": "192.168.101.60" },
|
||||||
@ -46,7 +51,8 @@
|
|||||||
"compute-novnc": { "host": "192.168.101.60" },
|
"compute-novnc": { "host": "192.168.101.60" },
|
||||||
"orchestration-api": { "host": "192.168.101.60" },
|
"orchestration-api": { "host": "192.168.101.60" },
|
||||||
"orchestration-api-cfn": { "host": "192.168.101.60" },
|
"orchestration-api-cfn": { "host": "192.168.101.60" },
|
||||||
"orchestration-api-cloudwatch": { "host": "192.168.101.60" }
|
"orchestration-api-cloudwatch": { "host": "192.168.101.60" },
|
||||||
|
"placement-api": { "host": "192.168.101.60" }
|
||||||
},
|
},
|
||||||
"public": {
|
"public": {
|
||||||
"identity": { "host": "192.168.101.60" },
|
"identity": { "host": "192.168.101.60" },
|
||||||
@ -59,11 +65,13 @@
|
|||||||
"compute-novnc": { "host": "192.168.101.60" },
|
"compute-novnc": { "host": "192.168.101.60" },
|
||||||
"orchestration-api": { "host": "192.168.101.60" },
|
"orchestration-api": { "host": "192.168.101.60" },
|
||||||
"orchestration-api-cfn": { "host": "192.168.101.60" },
|
"orchestration-api-cfn": { "host": "192.168.101.60" },
|
||||||
"orchestration-api-cloudwatch": { "host": "192.168.101.60" }
|
"orchestration-api-cloudwatch": { "host": "192.168.101.60" },
|
||||||
|
"placement-api": { "host": "192.168.101.60" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bind_service": {
|
"bind_service": {
|
||||||
"mq": { "host": "0.0.0.0" },
|
"db": { "host": "192.168.101.60" },
|
||||||
|
"mq": { "host": "192.168.101.60" },
|
||||||
"main": {
|
"main": {
|
||||||
"identity": { "host": "0.0.0.0" }
|
"identity": { "host": "0.0.0.0" }
|
||||||
},
|
},
|
||||||
@ -80,7 +88,8 @@
|
|||||||
"compute-novnc": { "host": "0.0.0.0" },
|
"compute-novnc": { "host": "0.0.0.0" },
|
||||||
"orchestration-api": { "host": "0.0.0.0" },
|
"orchestration-api": { "host": "0.0.0.0" },
|
||||||
"orchestration-api-cfn": { "host": "0.0.0.0" },
|
"orchestration-api-cfn": { "host": "0.0.0.0" },
|
||||||
"orchestration-api-cloudwatch": { "host": "0.0.0.0" }
|
"orchestration-api-cloudwatch": { "host": "0.0.0.0" },
|
||||||
|
"placement-api": { "host": "0.0.0.0" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dashboard": {
|
"dashboard": {
|
||||||
@ -91,7 +100,7 @@
|
|||||||
},
|
},
|
||||||
"network": {
|
"network": {
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"ml2": {
|
"ml2_openvswitch": {
|
||||||
"conf": {
|
"conf": {
|
||||||
"ml2_type_vxlan": {
|
"ml2_type_vxlan": {
|
||||||
"vni_ranges": "65537:69999",
|
"vni_ranges": "65537:69999",
|
||||||
@ -105,7 +114,7 @@
|
|||||||
"DEFAULT": {
|
"DEFAULT": {
|
||||||
"service_plugins": "router"
|
"service_plugins": "router"
|
||||||
},
|
},
|
||||||
"oslo_messaging_rabbit": { "rabbit_host": "192.168.101.60" },
|
"transport_url": { "rabbit_host": "192.168.101.60" },
|
||||||
"ml2": { "tenant_network_types": "vxlan" }
|
"ml2": { "tenant_network_types": "vxlan" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -117,7 +126,7 @@
|
|||||||
"libvirt": {
|
"libvirt": {
|
||||||
"virt_type": "qemu"
|
"virt_type": "qemu"
|
||||||
},
|
},
|
||||||
"oslo_messaging_rabbit": { "rabbit_host": "192.168.101.60" }
|
"transport_url": { "rabbit_host": "192.168.101.60" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "multi-node-compute",
|
"name": "multinode-compute",
|
||||||
"description": "This will deploy a compute node for a scenarios with just compute and controller nodes",
|
"description": "This will deploy a compute node for a scenarios with just compute and controller nodes",
|
||||||
"json_class": "Chef::Role",
|
"json_class": "Chef::Role",
|
||||||
"default_attributes": {
|
"default_attributes": {
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "multi-node-controller",
|
"name": "multinode-controller",
|
||||||
"description": "This will deploy a controller node for a scenarios with just compute and controller nodes",
|
"description": "This will deploy a controller node for a scenarios with just compute and controller nodes",
|
||||||
"json_class": "Chef::Role",
|
"json_class": "Chef::Role",
|
||||||
"default_attributes": {
|
"default_attributes": {
|
||||||
@ -22,23 +22,16 @@
|
|||||||
"recipe[openstack-image::api]",
|
"recipe[openstack-image::api]",
|
||||||
"recipe[openstack-image::registry]",
|
"recipe[openstack-image::registry]",
|
||||||
"recipe[openstack-image::identity_registration]",
|
"recipe[openstack-image::identity_registration]",
|
||||||
"recipe[openstack-network::identity_registration]",
|
|
||||||
"recipe[openstack-network::ml2_core_plugin]",
|
|
||||||
"recipe[openstack-network::ml2_openvswitch]",
|
|
||||||
"recipe[openstack-network]",
|
"recipe[openstack-network]",
|
||||||
"recipe[openstack-network::openvswitch]",
|
|
||||||
"recipe[openstack-network::_bridge_config_example]",
|
|
||||||
"recipe[openstack-network::plugin_config]",
|
|
||||||
"recipe[openstack-network::server]",
|
"recipe[openstack-network::server]",
|
||||||
"recipe[openstack-network::l3_agent]",
|
"recipe[openstack-network::ml2_core_plugin]",
|
||||||
"recipe[openstack-network::dhcp_agent]",
|
"recipe[openstack-network::openvswitch]",
|
||||||
"recipe[openstack-network::metadata_agent]",
|
|
||||||
"recipe[openstack-network::openvswitch_agent]",
|
|
||||||
"recipe[openstack-compute::nova-setup]",
|
"recipe[openstack-compute::nova-setup]",
|
||||||
"recipe[openstack-compute::identity_registration]",
|
"recipe[openstack-compute::identity_registration]",
|
||||||
"recipe[openstack-compute::conductor]",
|
"recipe[openstack-compute::conductor]",
|
||||||
"recipe[openstack-compute::api-os-compute]",
|
"recipe[openstack-compute::api-os-compute]",
|
||||||
"recipe[openstack-compute::api-metadata]",
|
"recipe[openstack-compute::api-metadata]",
|
||||||
|
"recipe[openstack-compute::placement_api]",
|
||||||
"recipe[openstack-compute::scheduler]",
|
"recipe[openstack-compute::scheduler]",
|
||||||
"recipe[openstack-compute::vncproxy]",
|
"recipe[openstack-compute::vncproxy]",
|
||||||
"recipe[openstack-compute::identity_registration]",
|
"recipe[openstack-compute::identity_registration]",
|
24
roles/multinode-network.json
Normal file
24
roles/multinode-network.json
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"name": "multinode-network",
|
||||||
|
"description": "This will deploy a controller node for a scenarios with just compute and controller nodes",
|
||||||
|
"json_class": "Chef::Role",
|
||||||
|
"default_attributes": {
|
||||||
|
},
|
||||||
|
"override_attributes": {
|
||||||
|
},
|
||||||
|
"chef_type": "role",
|
||||||
|
"run_list": [
|
||||||
|
"recipe[build-essential]",
|
||||||
|
"recipe[openstack-common]",
|
||||||
|
"recipe[openstack-common::logging]",
|
||||||
|
"recipe[openstack-common::sysctl]",
|
||||||
|
"recipe[openstack-network::ml2_openvswitch]",
|
||||||
|
"recipe[openstack-network::l3_agent]",
|
||||||
|
"recipe[openstack-network::dhcp_agent]",
|
||||||
|
"recipe[openstack-network::metadata_agent]",
|
||||||
|
"recipe[openstack-network::openvswitch_agent]"
|
||||||
|
],
|
||||||
|
"env_run_lists": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,24 @@
|
|||||||
require 'chef/provisioning'
|
require 'chef/provisioning'
|
||||||
|
require 'chef/provisioning/vagrant_driver'
|
||||||
|
|
||||||
default_bridge = '["en0: USB Ethernet","en1: USB Ethernet",'
|
with_driver 'vagrant'
|
||||||
default_bridge += '"en2: USB Ethernet","en3: USB Ethernet",'
|
|
||||||
default_bridge += '"en4: USB Ethernet","eth0","wlan0",'
|
os = 'ubuntu/xenial64'
|
||||||
default_bridge += '"en0: Wi-Fi (AirPort)","en1: Wi-Fi (AirPort)",'
|
os = 'centos/7' if ENV['REPO_OS'].to_s.include?('centos')
|
||||||
default_bridge += '"en2: Wi-Fi (AirPort)",'
|
|
||||||
default_bridge += '"Intel(R) Centrino(R) Advanced-N 6205"]'
|
env = 'allinone-ubuntu16'
|
||||||
|
env = 'allinone-centos7' if ENV['REPO_OS'].to_s.include?('centos')
|
||||||
|
|
||||||
|
# make sure your ethernet interface matches preferred_interfaces, or override
|
||||||
|
# with OS_BRIDGE
|
||||||
|
|
||||||
|
# rubocop:disable LineLength
|
||||||
|
preferred_interfaces = ['Ethernet', 'eth0', 'enp3s0', 'Wi-Fi',
|
||||||
|
'Thunderbolt 1', 'Thunderbolt 2', 'Centrino']
|
||||||
|
host_interfaces = `VBoxManage list bridgedifs | grep ^Name`
|
||||||
|
.gsub(/Name:\s+/, '').split("\n")
|
||||||
|
default_bridge = preferred_interfaces.map { |pi| host_interfaces.find { |vm| vm =~ /#{Regexp.quote(pi)}/ } }.compact[0]
|
||||||
|
# rubocop:enable LineLength
|
||||||
|
|
||||||
bridge = if ENV['OS_BRIDGE']
|
bridge = if ENV['OS_BRIDGE']
|
||||||
"\"#{ENV['OS_BRIDGE']}\""
|
"\"#{ENV['OS_BRIDGE']}\""
|
||||||
@ -13,30 +26,42 @@ bridge = if ENV['OS_BRIDGE']
|
|||||||
default_bridge
|
default_bridge
|
||||||
end
|
end
|
||||||
|
|
||||||
controller_config = <<-ENDCONFIG
|
###
|
||||||
config.vm.network "forwarded_port", guest: 443, host: 9443
|
# allinone compute controller
|
||||||
config.vm.network "forwarded_port", guest: 4002, host: 4002
|
###
|
||||||
config.vm.network "forwarded_port", guest: 5000, host: 5000
|
options = {
|
||||||
config.vm.network "forwarded_port", guest: 6080, host: 6080
|
vagrant_options: {
|
||||||
config.vm.network "forwarded_port", guest: 8773, host: 8773
|
'vm.box' => os,
|
||||||
config.vm.network "forwarded_port", guest: 8774, host: 8774
|
'vm.network' => [
|
||||||
config.vm.network "forwarded_port", guest: 35357, host: 35357
|
':forwarded_port, guest: 443, host: 9443',
|
||||||
|
':forwarded_port, guest: 4002, host: 4002',
|
||||||
|
':forwarded_port, guest: 5000, host: 5000',
|
||||||
|
':forwarded_port, guest: 6080, host: 6080',
|
||||||
|
':forwarded_port, guest: 8773, host: 8773',
|
||||||
|
':forwarded_port, guest: 8774, host: 8774',
|
||||||
|
':forwarded_port, guest: 35357, host: 35357'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
vagrant_config: <<-EOF
|
||||||
|
config.vm.provision "chef_solo" do |chef|
|
||||||
|
chef.version = "12.21.3"
|
||||||
|
chef.channel = "stable"
|
||||||
|
end
|
||||||
config.vm.provider "virtualbox" do |v|
|
config.vm.provider "virtualbox" do |v|
|
||||||
v.memory = 8192
|
v.memory = 8192
|
||||||
v.cpus = 4
|
v.cpus = 4
|
||||||
v.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
|
v.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
|
||||||
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
||||||
end
|
end
|
||||||
config.vm.network "private_network", :type => 'dhcp', :adapter => 2
|
config.vm.define "controller" do |cont|
|
||||||
config.vm.network "public_network",
|
cont.vm.network "private_network", :type => "dhcp", :adapter => 2
|
||||||
bridge: #{bridge}
|
cont.vm.network "public_network", :dev => "#{bridge}", :mode => "bridge", :type => "bridge"
|
||||||
ENDCONFIG
|
end
|
||||||
|
EOF
|
||||||
env = 'allinone-ubuntu16'
|
}
|
||||||
env = 'allinone-centos7' if ENV['REPO_OS'].to_s.include?('centos')
|
|
||||||
|
|
||||||
machine 'controller' do
|
machine 'controller' do
|
||||||
add_machine_options vagrant_config: controller_config
|
machine_options options
|
||||||
role 'allinone'
|
role 'allinone'
|
||||||
chef_environment env
|
chef_environment env
|
||||||
file('/etc/chef/openstack_data_bag_secret',
|
file('/etc/chef/openstack_data_bag_secret',
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
require 'chef/provisioning'
|
|
||||||
|
|
||||||
# config for controller-node vagrant box
|
|
||||||
controller_config = <<-ENDCONFIG
|
|
||||||
config.vm.network "forwarded_port", guest: 443, host: 9443 # dashboard-ssl
|
|
||||||
config.vm.network "forwarded_port", guest: 4002, host: 4002
|
|
||||||
config.vm.network "forwarded_port", guest: 5000, host: 5000
|
|
||||||
config.vm.network "forwarded_port", guest: 8774, host: 8774 # compute-api
|
|
||||||
config.vm.network "forwarded_port", guest: 35357, host: 35357
|
|
||||||
config.vm.provider "virtualbox" do |v|
|
|
||||||
v.memory = 6144
|
|
||||||
v.cpus = 2
|
|
||||||
v.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
|
|
||||||
v.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
|
|
||||||
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
|
||||||
end
|
|
||||||
config.vm.network "private_network", ip: "192.168.100.60"
|
|
||||||
config.vm.network "private_network", ip: "192.168.101.60"
|
|
||||||
ENDCONFIG
|
|
||||||
|
|
||||||
env = 'multi-node-ubuntu16'
|
|
||||||
env = 'multi-node-centos7' if ENV['REPO_OS'].to_s.include?('centos')
|
|
||||||
|
|
||||||
# create controller-node with config defined above
|
|
||||||
machine 'controller' do
|
|
||||||
add_machine_options vagrant_config: controller_config
|
|
||||||
role 'multi-node-controller'
|
|
||||||
chef_environment env
|
|
||||||
file('/etc/chef/openstack_data_bag_secret',
|
|
||||||
"#{File.dirname(__FILE__)}/../../../../../encrypted_data_bag_secret")
|
|
||||||
converge true
|
|
||||||
end
|
|
||||||
|
|
||||||
[%w(compute1 61), %w(compute2 62)].each do |name, ip_suff|
|
|
||||||
# config for compute-node vagrant box
|
|
||||||
compute_config = <<-ENDCONFIG
|
|
||||||
config.vm.provider "virtualbox" do |v|
|
|
||||||
v.memory = 2048
|
|
||||||
v.cpus = 2
|
|
||||||
v.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
|
|
||||||
v.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
|
|
||||||
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
|
||||||
end
|
|
||||||
config.vm.network "private_network", ip: "192.168.100.#{ip_suff}"
|
|
||||||
config.vm.network "private_network", ip: "192.168.101.#{ip_suff}"
|
|
||||||
ENDCONFIG
|
|
||||||
|
|
||||||
# create compute-node with config defined above
|
|
||||||
machine name do
|
|
||||||
add_machine_options vagrant_config: compute_config
|
|
||||||
role 'multi-node-compute'
|
|
||||||
chef_environment env
|
|
||||||
file('/etc/chef/openstack_data_bag_secret',
|
|
||||||
"#{File.dirname(__FILE__)}/../../../../../encrypted_data_bag_secret")
|
|
||||||
converge true
|
|
||||||
end
|
|
||||||
end
|
|
149
site-cookbooks/provisioning/recipes/multinode.rb
Normal file
149
site-cookbooks/provisioning/recipes/multinode.rb
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
require 'chef/provisioning'
|
||||||
|
require 'chef/provisioning/vagrant_driver'
|
||||||
|
|
||||||
|
with_driver 'vagrant'
|
||||||
|
|
||||||
|
os = 'ubuntu/xenial64'
|
||||||
|
os = 'centos/7' if ENV['REPO_OS'].to_s.include?('centos')
|
||||||
|
|
||||||
|
env = 'multinode-ubuntu16'
|
||||||
|
env = 'multinode-centos7' if ENV['REPO_OS'].to_s.include?('centos')
|
||||||
|
|
||||||
|
# make sure your ethernet interface matches preferred_interfaces, or override
|
||||||
|
# with OS_BRIDGE
|
||||||
|
|
||||||
|
# rubocop:disable LineLength
|
||||||
|
preferred_interfaces = ['Ethernet', 'eth0', 'enp3s0', 'Wi-Fi',
|
||||||
|
'Thunderbolt 1', 'Thunderbolt 2', 'Centrino']
|
||||||
|
host_interfaces = `VBoxManage list bridgedifs | grep ^Name`
|
||||||
|
.gsub(/Name:\s+/, '').split("\n")
|
||||||
|
default_bridge = preferred_interfaces.map { |pi| host_interfaces.find { |vm| vm =~ /#{Regexp.quote(pi)}/ } }.compact[0]
|
||||||
|
# rubocop:enable LineLength
|
||||||
|
|
||||||
|
bridge = if ENV['OS_BRIDGE']
|
||||||
|
"\"#{ENV['OS_BRIDGE']}\""
|
||||||
|
else
|
||||||
|
default_bridge
|
||||||
|
end
|
||||||
|
|
||||||
|
###
|
||||||
|
# compute controller
|
||||||
|
###
|
||||||
|
|
||||||
|
controller_options = {
|
||||||
|
vagrant_options: {
|
||||||
|
'vm.box' => os,
|
||||||
|
'vm.network' => [
|
||||||
|
':private_network, {ip: "192.168.100.60"}',
|
||||||
|
':private_network, {ip: "192.168.101.60"}',
|
||||||
|
':forwarded_port, guest: 443, host: 9443',
|
||||||
|
':forwarded_port, guest: 4002, host: 4002',
|
||||||
|
':forwarded_port, guest: 5000, host: 5000',
|
||||||
|
':forwarded_port, guest: 6080, host: 6080',
|
||||||
|
':forwarded_port, guest: 8773, host: 8773',
|
||||||
|
':forwarded_port, guest: 8774, host: 8774',
|
||||||
|
':forwarded_port, guest: 35357, host: 35357'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
vagrant_config: <<-EOH
|
||||||
|
config.vm.provision "chef_solo" do |chef|
|
||||||
|
chef.version = "12.21.3"
|
||||||
|
chef.channel = "stable"
|
||||||
|
end
|
||||||
|
config.vm.provider "virtualbox" do |v|
|
||||||
|
v.memory = 6144
|
||||||
|
v.cpus = 2
|
||||||
|
v.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
|
||||||
|
v.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
|
||||||
|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
||||||
|
end
|
||||||
|
EOH
|
||||||
|
}
|
||||||
|
|
||||||
|
# create controller node with the config defined above
|
||||||
|
machine 'controller' do
|
||||||
|
machine_options controller_options
|
||||||
|
role 'multinode-controller'
|
||||||
|
chef_environment env
|
||||||
|
file('/etc/chef/openstack_data_bag_secret',
|
||||||
|
"#{File.dirname(__FILE__)}/../../../../../encrypted_data_bag_secret")
|
||||||
|
converge true
|
||||||
|
end
|
||||||
|
|
||||||
|
###
|
||||||
|
# network controller config
|
||||||
|
###
|
||||||
|
|
||||||
|
network_options = {
|
||||||
|
vagrant_options: {
|
||||||
|
'vm.box' => os,
|
||||||
|
'vm.network' => [
|
||||||
|
':private_network, {ip: "192.168.100.70"}',
|
||||||
|
':private_network, {ip: "192.168.101.70"}'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
vagrant_config: <<-EOH
|
||||||
|
config.vm.provision "chef_solo" do |chef|
|
||||||
|
chef.version = "12.21.3"
|
||||||
|
chef.channel = "stable"
|
||||||
|
end
|
||||||
|
config.vm.provider "virtualbox" do |v|
|
||||||
|
v.memory = 1024
|
||||||
|
v.cpus = 1
|
||||||
|
v.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
|
||||||
|
v.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
|
||||||
|
v.customize ["modifyvm", :id, "--nicpromisc4", "allow-all"]
|
||||||
|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
||||||
|
end
|
||||||
|
config.vm.define "network" do |net|
|
||||||
|
net.vm.network "public_network", :dev => "#{bridge}", :mode => "bridge", :type => "bridge"
|
||||||
|
end
|
||||||
|
EOH
|
||||||
|
}
|
||||||
|
|
||||||
|
# create network node with the config defined above
|
||||||
|
machine 'network' do
|
||||||
|
machine_options network_options
|
||||||
|
role 'multinode-network'
|
||||||
|
chef_environment env
|
||||||
|
file('/etc/chef/openstack_data_bag_secret',
|
||||||
|
"#{File.dirname(__FILE__)}/../../../../../encrypted_data_bag_secret")
|
||||||
|
converge true
|
||||||
|
end
|
||||||
|
|
||||||
|
machine_batch do
|
||||||
|
compute_nodes = 2
|
||||||
|
compute_nodes.times do |number|
|
||||||
|
compute_options = {
|
||||||
|
vagrant_options: {
|
||||||
|
'vm.box' => os,
|
||||||
|
'vm.network' => [
|
||||||
|
":private_network, {ip: '192.168.100.#{61 + number}'}",
|
||||||
|
":private_network, {ip: '192.168.101.#{62 + number}'}"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
vagrant_config: <<-EOH
|
||||||
|
config.vm.provision "chef_solo" do |chef|
|
||||||
|
chef.version = "12.21.3"
|
||||||
|
chef.channel = "stable"
|
||||||
|
end
|
||||||
|
config.vm.provider "virtualbox" do |v|
|
||||||
|
v.memory = 1024
|
||||||
|
v.cpus = 2
|
||||||
|
v.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
|
||||||
|
v.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
|
||||||
|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
||||||
|
end
|
||||||
|
EOH
|
||||||
|
}
|
||||||
|
# create compute nodes with the config defined above
|
||||||
|
machine "compute#{number + 1}" do
|
||||||
|
machine_options compute_options
|
||||||
|
role 'multinode-compute'
|
||||||
|
chef_environment env
|
||||||
|
file('/etc/chef/openstack_data_bag_secret',
|
||||||
|
"#{File.dirname(__FILE__)}/../../../../../encrypted_data_bag_secret")
|
||||||
|
converge true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -1,9 +0,0 @@
|
|||||||
require 'chef/provisioning/vagrant_driver'
|
|
||||||
|
|
||||||
os = 'ubuntu/xenial64'
|
|
||||||
os = 'centos/7' if ENV['REPO_OS'].to_s.include?('centos')
|
|
||||||
|
|
||||||
with_driver 'vagrant'
|
|
||||||
with_machine_options vagrant_options: {
|
|
||||||
'vm.box' => os
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user