Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Server Locality with Razor and LLDP - PuppetCon...

Avatar for Jonas Rosland Jonas Rosland
September 26, 2014

Server Locality with Razor and LLDP - PuppetConf 2014

Avatar for Jonas Rosland

Jonas Rosland

September 26, 2014

More Decks by Jonas Rosland

Other Decks in Technology

Transcript

  1. Server locality with Razor and LLDP Jonas Rosland Developer Advocate

    @EMC @virtualswede purevirtual.eu emccode.github.io
  2. About me Loves automation Using Razor and Puppet for 2

    years Spends way too much time playing with new tools Retro and indie gamer
  3. Quick primer on Razor Awesome provisioning tool Policy based No

    manual labor needed (except racking and cabling) Not even needing to find the MAC address or anything like that Just create a policy, and boot up your servers
  4. 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 hostname 5. Node metadata 6. Tags (very important)
  5. 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"}] }
  6. What happens when you boot up the server? It boots

    up the Razor MicorKernel Feeds all the HW info back to Razor
  7. Like this root@razor:~# razor nodes node1 facts From 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>
  8. What happens after you boot up the server? Razor applies

    a policy if the HW info matches a tag A tag might look like: { "name": "small","rule": ["and", ["=", ["num", ["fact", "processorcount"]], 1], ["=", ["fact", "is_virtual"], "true"]] }
  9. 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 thing Might not apply if you want more control over what actually gets installed where
  10. Example 1 You have three racks of servers They all

    look alike You want to install the top 10 with VMware vSphere The bottom 10 with Cloudera Hadoop
  11. Example 2 You have three racks of servers They are

    not alike You want to install the top 5 with OpenStack compute The next 5 with VMware vSphere The next 5 with Cloudera Hadoop And the bottom 5 with EMC ScaleIO And you want each group in a certain order
  12. Extend the HW facts Use a script to collect more

    facts about a node Add that into a few defined folders Zip it up Point it out in the Razor config file ... Profit!
  13. 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
  14. 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
  15. Server locality with Razor and LLDP Using openlldp.rb created by

    Mike Arnold Adding binaries and libraries for LLDP Contained in a zip file Pointed it out in the Razor config file ... Result?
  16. Making a shift Random pools still exist Adding control over

    what goes where Not an or but an and scenario Get both and enjoy the benefits!
  17. 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