Bare Metal to OpenStack with Razor and Chef


Published on

Slides from the OpenStack Spring 2013 Summit workshop presented by Egle Sigler (@eglute) and Matt Ray (@mattray) from Rackspace and Opscode respectively. Please refer to for additional content.

Published in: Technology

Bare Metal to OpenStack with Razor and Chef

  1. 1. Bare Metal to OpenStackwith Razor and ChefEgle Sigler, RackspaceMatt Ray, Opscode
  2. 2. AgendaRazor Introduction and OverviewRazor demonstrationOpenStack cookbook walkthrough
  3. 3. Get Razor ApplianceUSB keys (thanks to eNovance, Suse, and Piston)Wireless network: razor5 and razor24 (thank you Rackers!)Start downloading/copyinghttp://
  4. 4. Setting up Razor Appliance in Virtual BoxMust have extension pack installed. Get it here: Verify extension pack is installed: VBoxManage list extpacksFile/Import Appliance...Default options for everything
  5. 5. Setting up Razor Appliance inVMware Fusion File/Import: select ovf file, ignore warnings. File/Import Appliance... Set up two nics for the VM, second one internal Make sure the DHCP for internal nic is turned off, under VMware Fusion/Preferences.../Network
  6. 6. Fusion Network 1
  7. 7. Fusion Network 2
  8. 8. Fusion Network 2 Preferences
  9. 9. Razor ApplianceBuilt on Ubuntu Server, 12.04, for this tutorialMust have two nics, one for external, one for internal trafficComes with: Razor TFTP service DHCP service MongoDB Chef Server Rackspace Private Cloud Cookbooks MicroKernel and Ubuntu Server ISO
  10. 10. Logging InUser name: anystackerPassword: razorLogin, and switch to root.Verify razor is running:root@razor:~# /opt/razor/bin/razor_daemon.rb statusIf not:root@razor:~# /opt/razor/bin/razor_daemon.rb start
  11. 11. About RazorProvisioning solution for hardwareInitially developed by EMC and PuppetOpen sourced as a Puppet Labs projectInstall using Puppet, Chef, or manual
  12. 12. About RazorAuto-Discovered Real-Time Inventory DataDynamic Image SelectionModel-Based ProvisioningAPIs and Plug-in ArchitectureMetal-to-Cloud Application Lifecycle Management
  13. 13. Razor State of Things
  14. 14. Razor State of ThingsRazor is awesome!Still not a 1.* releaseMongoDB may cause concurrency issuesPolicy limit counts may not be enforcedSome other issues
  15. 15. Bright and Shiny Futurev1.0 release focus on stability and scalability: Beta version in Q3 support concurrency scale well easy to install, upgrade, and test
  16. 16. Bright and Shiny FutureAfter v1.0: Windows support maybe AIX and Solaris support
  17. 17. Connecting to Razor VMVirtualBox: ssh -p 2223 localhostVMware Fusion: get IP and ssh to it
  18. 18. Hands On RazorUser name: anystackerPassword: razorSwitch to root.
  19. 19. Verify StatusVerify razor is running:root@razor:~# /opt/razor/bin/razor_daemon.rb statusIf not:root@razor:~# /opt/razor/bin/razor_daemon.rb startCheck networks
  20. 20. ifconfigroot@razor:~# ifconfigeth1 Link encap:Ethernet HWaddr 00:0c:29:aa:f9:65inet addr: Bcast: Mask: addr: fe80::20c:29ff:feaa:f965/64 Scope:LinkUP BROADCAST RUNNING MULTICAST MTU:1500Metric:1RX packets:7525 errors:0 dropped:0 overruns:0 frame:0TX packets:19 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:677489 (677.4 KB) TX bytes:2362 (2.3 KB)
  21. 21. Razor Commandsadd MikroKerneladd Imageadd Modeladd Policyadd Broker
  22. 22. MicroKernelVariant of Tiny Core LinuxFound here: to add it once:razor image add -t mk -p ./rz_mk_prod-image.
  23. 23. Add Image razor image add -t os -p ./ubuntu-12.04.2- server-amd64.iso -n ubuntu_precise_server -v 12.04.2Attempting to add, please wait...New image added successfully
  24. 24. Added Image: UUID => 36Lrq9JMiRwvrw5rSruSjg Type => OS Install ISO Filename => ubuntu-12.04.2-server-amd64.iso Path => /opt/razor/image/os/36Lrq9JMiRwvrw5rSruSjg Status => Valid OS Name => ubuntu_precise_server OS Version => 12.04.2
  25. 25. Model Map image to built-in templaterazor model add template -t ubuntu_precise -l install_precise_server -i36Lrq9JMiRwvrw5rSruSjg
  27. 27. razor model add template -t ubuntu_precise -linstall_precise_server -i 36Lrq9JMiRwvrw5rSruSjg--- Building Model (ubuntu_precise):Please enter node hostname prefix (will append nodenumber) (example: node)default: node(QUIT to cancel) >Please enter local domain name (will be used in /etc/hosts file) (example: localdomain(QUIT to cancel) >Please enter root password (> 8 characters) (example:P@ssword!)default: test1234(QUIT to cancel) >
  28. 28. ModelModel created Label => install_precise_server Template => linux_deploy Description => Ubuntu Precise Model UUID => 5VShcTIkmqrCXGUBM3UwLI Image UUID => 36Lrq9JMiRwvrw5rSruSjg
  29. 29. Policy Map model to a noderazor policy add -p linux_deploy -l precise_server -m5VShcTIkmqrCXGUBM3UwLI -t nics_1 --enabled truePolicy created UUID => 6BtPna2OuYDcFPZr7ec1XU Line Number => 0 Label => precise_server Enabled => true Template => linux_deploy Description => Policy for deploying a Linux-based operatingsystem. Tags => [nics_1] Model Label => install_precise_server Broker Target => none Currently Bound => 0 Maximum Bound => 0 Bound Counter => 0
  30. 30. Razor BrokersPuppetChefScript
  31. 31. Brokersroot@razor:~# razor broker pluginAvailable Broker Plugins:Plugin Descriptionchef Opscode Chefpuppet PuppetLabs PuppetMaster
  32. 32. Puppet BrokerIf you use Puppet, use it.Puppet Master hostnamePuppet version
  33. 33. Chef BrokerBootstrap installURL for Chef Server, https:hostnameChef versionvalidation.pem filevalidation client nameChef environmentOmnibus installer scriptalternative path for chef-client binaryrun list
  34. 34. Script BrokerVery new, not on Razor applianceRuns scripts on the newly installed nodeSoon, will gain special powers: pre and post scripts run on Razor server for full integration with tools (signing Puppet certificate, etc)
  35. 35. Add Brokerrazor broker add -p chef -n allinone -dopenstack_allinone--- Building Broker (chef):... lots of stuff
  36. 36. Add Broker to Policyrazor policy add -p linux_deploy -lprecise_server -m 5VShcTIkmqrCXGUBM3UwLI -t nics_2 --enabled true
  37. 37. razor policy update 28kDQSkIVWtp9DFOuQdAgK -b4uiuMcQVoePYmKOc3QLeRE UUID => 28kDQSkIVWtp9DFOuQdAgK Line Number => 1 Label => precise_server Enabled => true Template => linux_deploy Description => Policy for deploying a Linux-based operating system. Tags => [nics_2] Model Label => install_precise_server Broker Target => allinone Currently Bound => 0 Maximum Bound => 0 Bound Counter => 0
  38. 38. Boot VMCreate new VMMake sure it has 2 nics, both on private network2 GB memory80 GB diskon VirtualBox, set boot orderConnect to real internets, otherwise chef client will notinstall
  39. 39.
  40. 40. All in one OpenStack onyour VMIf all goes well, OpenStack should be running oryour new VMTry setting up additional policies, and deploydifferent VMs
  41. 41. AgendaRazor Introduction and OverviewRazor demonstrationOpenStack cookbook walkthrough
  42. 42. AgendaRazor Introduction and OverviewRazor demonstrationOpenStack cookbook walkthrough
  43. 43. Rackspace Private Cloudcurrently Folsom release (v3.0.1)open source Chef 11 server embedded
  44. 44. Rackspace Private Cloud
  45. 45. Rackspace Private
  46. 46. cookbooks/apache2/ monit/apt/ monitoring/aws/ mysql/build-essential/ mysql-openstack/cinder/ nova/collectd/ nova-network/collectd-graphite/ ntp/collectd-plugins/ openssh/corosync/ openssl/database/ openstack-ha/dsh/ osops-utils/erlang/ postgresql/exerstack/ rabbitmq/glance/ rabbitmq-openstack/graphite/ rsyslog/haproxy/ runit/hardware/ selinux/horizon/ sosreport/keepalived/ swift/keystone/ sysctl/kong/ xfs/memcached/ yum/modules/
  47. 47. environments/example.json{ "name": "example_environment", "description": "Chef-server example environment", "cookbook_versions": { }, "json_class": "Chef::Environment", "chef_type": "environment", "default_attributes": { }, "override_attributes": { "developer_mode": false, "monitoring" : { "metric_provider" : "collectd", "procmon_provider" : "monit" }, "glance": { "image_upload": true, "images": ["cirros", "precise"] },
  48. 48. environments/example.json"nova": { "ratelimit" : { "api" : { "enabled" : true }, "volume" : { "enabled" : true } }, "libvirt": { "virt_type": "qemu" }, "networks": [ { "label": "public", "ipv4_cidr": "", "num_networks": "1", "network_size": "255", "bridge": "br100", "bridge_dev": "eth0.100", "dns1": "", "dns2": "" }, { "label": "private", "ipv4_cidr": "", "num_networks": "1", "network_size": "255", "bridge": "br101", "bridge_dev": "eth0.101", "dns1": "", "dns2": "" } ]},
  49. 49. environments/example.json "mysql": { "allow_remote_root": true, "root_network_acl": "%" }, "osops_networks": { "nova": "", "public": "", "management": "" }, "package_component": "folsom" }}
  50. 50. roles/allinone.rb nova-api-ec2.rbbase.rb nova-api-os-compute.rbcinder-all.rb nova-api.rbcinder-api.rb nova-cert.rbcinder-scheduler.rb nova-controller.rbcinder-setup.rb nova-misc-services.rbcinder-volume.rb nova-network-compute.rbcollectd-client.rb nova-network-controller.rbcollectd-server.rb nova-network.rbglance-api.rb nova-scheduler.rbglance-registry.rb nova-setup.rbglance-setup.rb nova-vncproxy.rbglance.rb nova-volume.rbgraphite.rb openstack-ha.rbha-controller1.rb quantum-network-manager.rbha-controller2.rb rabbitmq-server.rbhaproxy.rb rsyslog-client.rbhorizon-server.rb rsyslog-server.rbjenkins-allinone.rb single-compute.rbjenkins-compute.rb single-controller.rbjenkins-controller.rb swift-account-server.rbjenkins-glance.rb swift-all-in-one.rbjenkins-mysql-master.rb swift-container-server.rbjenkins-nova-api.rb swift-management-server.rbkeystone-api.rb swift-object-server.rbkeystone.rb swift-proxy-server.rbmysql-master.rb swift-setup.rb
  51. 51. roles/allinone.rbname "allinone"description "This will create an all-in-one Openstack cluster"run_list( "role[single-controller]", "role[single-compute]")
  52. 52. expanded run listosops-utils::packages, openssh, ntp, sosreport,rsyslog::default, hardware, osops-utils::default, mysql-openstack::server,erlang::default, rabbitmq-openstack::server,keystone::server, keystone::keystone-api,glance::setup, glance::registry, glance::api,nova::nova-setup, nova-network::nova-controller,nova::scheduler, nova::api-ec2, nova::api-os-compute, nova::volume, nova::nova-cert,nova::vncproxy, mysql::client, mysql::ruby,horizon::server, nova-network::nova-compute,nova::compute
  53. 53. roles/single-controllername "single-controller"description "Nova Controller (non-HA)"run_list( "role[base]", "role[mysql-master]", "role[rabbitmq-server]", "role[keystone]", "role[glance-setup]", "role[glance-registry]", "role[glance-api]", "role[nova-setup]", "role[nova-network-controller]", "role[nova-scheduler]", "role[nova-api-ec2]", "role[nova-api-os-compute]", "role[nova-volume]", "role[nova-cert]", "role[nova-vncproxy]", "role[horizon-server]")
  54. 54. roles/basename "base"description "Base role for a server"run_list( "recipe[osops-utils::packages]", "recipe[openssh]", "recipe[ntp]", "recipe[sosreport]", "recipe[rsyslog::default]", "recipe[hardware]", "recipe[osops-utils::default]")default_attributes( "ntp" => { "servers" => ["", "",""] })
  55. 55. roles/mysql-mastername "mysql-master"description "Installs mysql and sets upreplication (if 2 nodes with role)"run_list( "role[base]", "recipe[mysql-openstack::server]")
  56. 56. roles/rabbitmq-servername "rabbitmq-server"description "RabbitMQ Server (non-ha)"run_list( "role[base]", "recipe[erlang::default]", "recipe[rabbitmq-openstack::server]")
  57. 57. roles/keystonename "keystone"description "Keystone server"run_list( "role[base]", "recipe[keystone::server]", "role[keystone-api]")
  58. 58. roles/glance-setupname "glance-setup"description "sets up glance registry dband passwords"run_list( "role[base]", "recipe[glance::setup]")
  59. 59. roles/glance-registryname "glance-registry"description "Glance Registry server"run_list( "role[base]", "recipe[glance::registry]")
  60. 60. roles/glance-apiname "glance-api"description "Glance API server"run_list( "role[base]", "recipe[glance::api]")
  61. 61. roles/nova-setupname "nova-setup"description "Where the setup operationsfor nova get run"run_list( "recipe[nova::nova-setup]")
  62. 62. /nova-network-controllername "nova-network-controller"description "Setup nova-networking forcontroller node"run_list( "recipe[nova-network::nova-controller]")
  63. 63. roles/nova-schedulername "nova-scheduler"description "Nova scheduler"run_list( "role[base]", "recipe[nova::scheduler]")
  64. 64. roles/nova-api-ec2name "nova-api-ec2"description "Nova API EC2"run_list( "role[base]", "recipe[nova::api-ec2]")
  65. 65. /nova-api-os-computename "nova-api-os-compute"description "Nova API for Compute"run_list( "role[base]", "recipe[nova::api-os-compute]")
  66. 66. roles/nova-volumename "nova-volume"description "Nova Volume Service"run_list( "role[base]", "recipe[nova::volume]")
  67. 67. roles/nova-certname "nova-cert"description "Nova Certificate Service"run_list( "role[base]", "recipe[nova::nova-cert]")
  68. 68. roles/nova-vncproxyname "nova-vncproxy"description "Nova VNC Proxy"run_list( "role[base]", "recipe[nova::vncproxy]")
  69. 69. roles/horizon-servername "horizon-server"description "Horizon server"run_list( "role[base]", "recipe[mysql::client]", "recipe[mysql::ruby]", "recipe[horizon::server]")
  70. 70. roles/single-computename "single-compute"description "Nova compute (with non-HAController)"run_list( "role[base]", "role[nova-network-compute]", "recipe[nova::compute]")
  71. 71. Thanks!Egle Sigleregle.sigler@rackspace.comMatt