Server Locality Using Razor and LLDP - PuppetConf 2014
-
Upload
puppet-labs -
Category
Technology
-
view
553 -
download
3
description
Transcript of Server Locality Using Razor and LLDP - PuppetConf 2014
![Page 1: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/1.jpg)
Server localitywith Razor and LLDP
Jonas RoslandDeveloper Advocate @EMC
@virtualswedepurevirtual.eu
emccode.github.io
![Page 2: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/2.jpg)
About me
Loves automationUsing Razor and Puppet for 2 yearsSpends way too much time playing with new toolsRetro and indie gamer
![Page 3: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/3.jpg)
Quick primer on RazorAwesome provisioning toolPolicy basedNo manual labor needed (except racking and cabling)Not even needing to find the MAC address or anything like thatJust create a policy, and boot up your servers
![Page 4: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/4.jpg)
So what's in a policy?A few things:1. The repository to install from (repo)2. What to install (task)3. What to hand off to after deployment (broker)4. Stuff like root passwords and hostname5. Node metadata6. Tags (very important)
![Page 5: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/5.jpg)
Something like this{ "name": "centos", "repo": { "name": "centos" }, "task": { "name": "centos" }, "broker": { "name": "noop" }, "enabled": true, "hostname": "host.lab.purevirtual.eu", "root_password": "secret", "max_count": 10, "node-metadata": { "who-is-awesome": "you", "favourite-mst3k-episode": "Pumaman" }, "tags": [{ "name": "small-vm"}]}
![Page 6: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/6.jpg)
What happens when you boot up the server?It boots up the Razor MicorKernelFeeds all the HW info back to Razor
![Page 7: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/7.jpg)
Like thisroot@razor:~# razor nodes node1 factsFrom http://localhost:8080/api/collections/nodes/node1:<snip> processorcount: 1 interfaces: enp0s3,lo ipaddress_enp0s3: 192.168.1.148 macaddress_enp0s3: 08:00:27:ad:77:a2 netmask_enp0s3: 255.255.255.0<snip> is_virtual: true uniqueid: 007f0100 blockdevice_sda_size: 8589934592 uuid: 7935347B-FE5C-4381-82DD-C81093109CCF<snip>
![Page 8: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/8.jpg)
What happens after you boot up the server?Razor applies a policy if the HW info matches a tagA tag might look like:{ "name": "small","rule": ["and", ["=", ["num", ["fact", "processorcount"]], 1], ["=", ["fact", "is_virtual"], "true"]]}
![Page 9: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/9.jpg)
So what if you have many servers that look alike?Razor grabs the next available one out of the "pool"Works very well if most of your servers run the same thingMight not apply if you want more control over what actually gets installed where
![Page 10: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/10.jpg)
Example 1You have three racks of serversThey all look alikeYou want to install the top 10 with VMware vSphereThe bottom 10 with Cloudera Hadoop
![Page 11: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/11.jpg)
Example 2You have three racks of serversThey are not alikeYou want to install the top 5 with OpenStack computeThe next 5 with VMware vSphereThe next 5 with Cloudera HadoopAnd the bottom 5 with EMC ScaleIOAnd you want each group in a certain order
![Page 12: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/12.jpg)
Or maybe something like this?
What to do?
![Page 13: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/13.jpg)
Enter Razor MicroKernel extensions
![Page 14: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/14.jpg)
Extend the HW factsUse a script to collect more facts about a nodeAdd that into a few defined foldersZip it upPoint it out in the Razor config file...Profit!
![Page 15: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/15.jpg)
MK extension folder info• the directory bin at the root of the zip is added to PATH
• the directory lib is added to LD_LIBRARY_PATH
• the directory lib/ruby is added to RUBYLIB
• the directory facts.d is used by Facter to load external facts
![Page 16: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/16.jpg)
MK extension configuration/opt/razor/config.yaml:
microkernel: debug_level: debug kernel_args: # If this value is present, and points to a zip file, it will be # downloaded and unpacked by the MK client prior to checkin. This allows # for custom facts and other code to be shipped to the client without # having to rebuild the ISO image. # # If it is not set, no update will be sent, and the ISO will use only the # default facts, etc, available in the default build. # extension-zip: /opt/razor/mk-extension.zip
![Page 17: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/17.jpg)
Server locality with Razor and LLDPUsing openlldp.rb created by Mike ArnoldAdding binaries and libraries for LLDPContained in a zip filePointed it out in the Razor config file...Result?
![Page 18: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/18.jpg)
Result lldp_neighbor_chassisid_ens2f0: 00:1c:73:28:65:d8 lldp_neighbor_portid_ens2f0: Ethernet17 lldp_neighbor_sysname_ens2f0: razor-switch1 lldp_neighbor_mngaddr_ipv4_ens2f0: lldp_neighbor_mngaddr_ipv6_ens2f0: lldp_neighbor_pvid_ens2f0: 1 lldp_neighbor_mtu_ens2f0: 9236
![Page 19: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/19.jpg)
Making a shiftRandom pools still existAdding control over what goes whereNot an or but an and scenarioGet both and enjoy the benefits!
![Page 20: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/20.jpg)
DEMOTIME
![Page 21: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/21.jpg)
Demo:
1. Show Razor facts without MK extension
2. Add MK extension
3. Show new facts getting in
4. Show tags that use the new facts
5. Show policies using the new tags
![Page 22: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/22.jpg)
Questions?
![Page 23: Server Locality Using Razor and LLDP - PuppetConf 2014](https://reader033.fdocuments.us/reader033/viewer/2022042521/547e89d85906b5d3718b4689/html5/thumbnails/23.jpg)
Thank you!Jonas Rosland@virtualswede