Dec 122012
 

Ever wanted to know what information Razor collects about your system that you could lay your hands on? Wonder no more!

When handing of your newly created node to a broker, besides installing the client and registering it with the server, Razor also injects custom facts into the new node. They consist of two parts, “razor_metadata” and “razor_attributes”. Razor metadata is available for both chef and puppet brokers, and consist of the following:

razor_metadata: {
    razor_tags: "memsize_1GiB,nics_1,cpus_1,IntelCorporation,vmware_vm",
    razor_node_uuid: "JtFXS98553aTEsrUhy6V9",
    razor_active_model_uuid: "PQG5iXxTIDGgEeIQ9qsnD",
    razor_model_uuid: "7RdhL19S5pBAAWTqNldfSl",
    razor_model_name: "ubuntu_precise",
    razor_model_description: "Ubuntu Precise Model",
    razor_model_template: "linux_deploy",
    razor_policy_count: "14"
}

Razor attributes are a bit more extensive, and I believe are currently injected only into the chef broker. This very detailed information about your system is collected by the Razor microkernel, and can also be found under active model/node/@attributes_hash in the database. The data looks like this:

razor_attributes: {
    mk_hw_cpu0_size: "2200MHz",
    mk_hw_lscpu_CPU_MHz: "2199.513",
    mk_hw_mem_description: "System Memory",
    mk_hw_nic0_clock: "66MHz",
    mk_hw_cpu0_physical_id: "4",
    ipaddress_lo: "127.0.0.1",
    mk_hw_fw_physical_id: "0",
    processorcount: "1",
    macaddress: "6A:8C:81:E3:6C:75",
    mk_hw_nic0_version: "01",
    mk_hw_disk0_size: "20GiB (21GB)",
    manufacturer: "VMware, Inc.",
    mk_hw_bus_version: "None",
    architecture: "i386",
    memorytotal: "1005.62 MB",
    mk_hw_nic_count: "1",
    mk_hw_disk_count: "1",
    mk_hw_lscpu_L2_cache: "256K",
    mk_hw_lscpu_CPU_sockets: "1",
    mk_hw_cpu0_slot: "CPU socket #0",
    network_lo: "127.0.0.0",
    hardwareisa: "unknown",
    mk_hw_lscpu_Stepping: "7",
    mk_hw_fw_capabilities: "isa pci pcmcia pnp apm upgrade shadowing escd cdboot bootselect edd int5printscreen int9keyboard int14serial int17printer int10video acpi smartbattery biosbootspecification netboot",
    "mk_hw_lscpu_CPU_op-modes": "32-bit, 64-bit",
    mk_hw_nic0_width: "64 bits",
    mk_hw_cpu0_vendor: "Intel Corp.",
    processor0: "Intel(R) Core(TM) i7-2720QM CPU @ 2.20GHz",
    mk_hw_lscpu_Byte_Order: "Little Endian",
    netmask_eth0: "255.255.255.0",
    mk_hw_fw_vendor: "Phoenix Technologies LTD",
    mk_hw_nic0_logical_name: "eth0",
    mk_hw_disk0_logical_name: "/dev/sda",
    domain: "dns.hosts",
    macaddress_dummy0: "6A:8C:81:E3:6C:75",
    boardserialnumber: "None",
    mk_hw_bus_vendor: "Intel Corporation",
    mk_hw_cpu0_capabilities: "boot fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss nx rdtscp x86-64 constant_tsc up arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes xsave avx hypervisor lahf_lm ida arat epb xsaveopt pln pts",
    mk_hw_mem_size: "1GiB",
    mk_hw_lscpu_L1i_cache: "32K",
    mk_hw_cpu0_serial: "0008-06A9-0187-0000-0000-0000",
    mk_hw_fw_size: "87KiB",
    network_eth0: "192.168.100.0",
    hostname: "mk000C291F2C5C",
    mk_hw_lscpu_Model: "42",
    netmask_lo: "255.0.0.0",
    mk_hw_nic0_capacity: "1Gbit/s",
    mk_hw_cpu0_product: "Intel(R) Core(TM) i7-2720QM CPU @ 2.20GHz",
    mk_hw_fw_description: "BIOS",
    ipaddress: "192.168.100.19",
    physicalprocessorcount: 1,
    macaddress_eth0: "00:0B:29:1F:2D:5C",
    mk_hw_nic0_bus_info: "pci@0000:02:01.0",
    mk_hw_disk0_bus_info: "scsi@2:0.0.0",
    boardproductname: "440BX Desktop Reference Platform",
    mk_hw_bus_product: "440BX Desktop Reference Platform",
    mk_hw_cpu0_width: "64 bits",
    mk_hw_mem_slot: "System board or motherboard",
    mk_hw_lscpu_L1d_cache: "32K",
    mk_hw_nic0_configuration: "autonegotiation=on broadcast=yes driver=e1000 driverversion=7.3.21-k8-NAPI duplex=full firmware=N/A ip=192.168.100.19 latency=0 link=yes mingnt=255 multicast=yes port=twisted pair speed=1Gbit/s",
    mk_hw_cpu0_version: "6.10.7",
    mk_hw_fw_date: "07/02/2012",
    fqdn: "mk000C291F2C5C.dns.hosts",
    mk_hw_lscpu_CPU_family: "6",
    virtual: "vmware",
    mk_hw_nic0_size: "1Gbit/s",
    mk_hw_cpu0_description: "CPU",
    serialnumber: "VMware-56 4c e7 4d ae 3c 03 d5-4f e6 9e dc a4 1f 3c 6c",
    mk_hw_bus_physical_id: "0",
    hardwaremodel: "i686",
    mk_hw_lscpu_Architecture: "i686",
    mk_hw_nic0_physical_id: "1",
    boardmanufacturer: "Intel Corporation",
    mk_hw_bus_description: "Motherboard",
    mk_hw_disk0_physical_id: "0.0.0",
    mk_hw_cpu0_capacity: "4230MHz",
    mk_hw_lscpu_BogoMIPS: "4400.31",
    mk_hw_mem_physical_id: "e2",
    type: "Other",
    mk_hw_nic0_capabilities: "pm pcix bus_master cap_list rom ethernet physical logical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation",
    mk_hw_cpu0_bus_info: "cpu@0",
    is_virtual: "true",
    mk_hw_fw_version: "6.00",
    netmask: "255.255.255.0",
    mk_hw_lscpu_Vendor_ID: "GenuineIntel",
    mk_hw_nic0_serial: "00:0c:27:2f:1c:7c",
    mk_hw_cpu_count: "1",
    ipaddress_eth0: "192.168.100.19",
    productname: "VMware Virtual Platform",
    mk_hw_bus_serial: "None",
    mk_hw_nic0_description: "Ethernet interface",
    interfaces: "dummy0,eth0,lo",
    mk_hw_lscpu_L3_cache: "6144K",
    memorysize: "1005.62 MB",
    mk_hw_disk0_description: "SCSI Disk"
}

Once this data is injected into the chef node, you can access it just like any other attribute.

-eglute

 Posted by at 11:32 pm
Dec 122012
 

If you are looking for info on the razor-server broker, check this blog post: http://anystacker.com/2014/01/razor-server-chef-broker/

A few weeks ago i posted about the razor chef broker, while it was still a work in progress.  After some awesome collaboration with Fletcher Nichol, Tom McSweeney, and Cody Bunch, chef broker is now officially part of Razor.

Originally, while puppet broker was the only one available, the CLI options for adding a broker were geared towards it.  While working on chef razor, many more options were needed, so the whole CLI interaction for adding a broker changed. The new flow flows much nicer, in my opinion!

Here is a simple example of adding new razor broker, step by step.
Lets check available plugins, make sure that the chef is one of the available options:

root@ubuntu:/opt/razor# razor broker get plugins

Available Broker Plugins:
 Plugin Description
 puppet PuppetLabs PuppetMaster
 chef Opscode Chef
 root@ubuntu:/opt/razor#

List current brokers:

root@ubuntu:/opt/razor# razor broker
 Broker Targets:
 Name Description Plugin UUID
 puppet puppet puppet 11fTD6ejTXmbS4nyIu0ZF5

Lets add a new broker (-p for plugin, -n for name, -d for description):

root@ubuntu:/opt/razor# razor broker add -p chef -n Chef -d Production
 --- Building Broker (chef):
Please enter the URL for the Chef server. (example: https://chef.example.com:4000)
 (QUIT to cancel)

Your chef server can be in any valid URL format, whether it be IP:port, or just IP. This is were your new client will be connecting to to call home.

 > https://chef.example.com:4000

What chef version do you want to use?

Please enter the Chef version (used in gem install). (example: 10.16.2)
(QUIT to cancel)
> 10.16.2

Chef client needs a server validation file. This generally can be found on your server under /etc/chef/validation.pem. Copy the whole file, paste, and add a blank line:

Please enter a paste of the contents of the validation.pem file, followed by a blank line. (example: -----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAA...) 
(QUIT to cancel)
 > -----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEA1cvdmA1J754VQUAxZRNYHHqs2nIiL7xlcp1LQP9N7LQyZ+XM
G61m8es5TMPLGNk20DqE46ZVQPlcIgZmnq6G42jPERRcpkhleNLegaDEM0Fkt0tr
MIIEowIBAAKCAQEA1cvdmA1J754VQUAxZRNYHHqs2nIiL7xlcp1LQP9N7LQyZ+XM
G61m8es5TMPLGNk20DqE46ZVQPlcIgZmnq6G42jPERRcpkhleNLegaDEM0Fkt0tr
MIIEowIBAAKCAQEA1cvdmA1J754VQUAxZRNYHHqs2nIiL7xlcp1LQP9N7LQyZ+XM
G61m8es5TMPLGNk20DqE46ZVQPlcIgZmnq6G42jPERRcpkhleNLegaDEM0Fkt0tr
MIIEowIBAAKCAQEA1cvdmA1J754VQUAxZRNYHHqs2nIiL7xlcp1LQP9N7LQyZ+XM
G61m8es5TMPLGNk20DqE46ZVQPlcIgZmnq6G42jPERRcpkhleNLegaDEM0Fkt0tr
MIIEowIBAAKCAQEA1cvdmA1J754VQUAxZRNYHHqs2nIiL7xlcp1LQP9N7LQyZ+XM
G61m8es5TMPLGNk20DqE46ZVQPlcIgZmnq6G42jPERRcpkhleNLegaDEM0Fkt0tr
MIIEowIBAAKCAQEA1cvdmA1J754VQUAxZRNYHHqs2nIiL7xlcp1LQP9N7LQyZ+XM
G61m8es5TMPLGNk20DqE46ZVQPlcIgZmnq6G42jPERRcpkhleNLegaDEM0Fkt0tr
MIIEowIBAAKCAQEA1cvdmA1J754VQUAxZRNYHHqs2nIiL7xlcp1LQP9N7LQyZ+XM
G61m8es5TMPLGNk20DqE46ZVQPlcIgZmnq6G42jPERRcpkhleNLegaDEM0Fkt0tr
MIIEowIBAAKCAQEA1cvdmA1J754VQUAxZRNYHHqs2nIiL7xlcp1LQP9N7LQyZ+XM
G61m8es5TMPLGNk20DqE46ZVQPlcIgZmnq6G42jPERRcpkhleNLegaDEM0Fkt0tr
bpZhB1UOoeKVyq4c8Oza8Mrs/OEQcoBSHZwVFmErOyf/Ree4nVIC
-----END RSA PRIVATE KEY-----

How should your client auth against chef server? More info on chef auth can be found here: http://wiki.opscode.com/display/chef/Authentication+and+Authorization

Please enter the validation client name. (example: myorg-validator) 
default: chef-validator
(QUIT to cancel)
 > chef-validator

Which environment? More about Chef environments: http://wiki.opscode.com/display/chef/Environments

Please enter the Chef environment in which the chef-client will run. (example: production) 
default: _default
(QUIT to cancel)
 >

This script will actually perform the installation. Replace with your own if you don’t trust the internets!

Please enter the Omnibus installer script URL. (example: http://mirror.example.com/install.sh) 
default: http://opscode.com/chef/install.sh
(QUIT to cancel)
 >

More custom options, press enter for default:

Please enter an alternate path to the chef-client binary. (example: /usr/local/bin/chef-client) 
default: chef-client
(QUIT to cancel)
 >

Optional run list, type “SKIP” if you don’t have any.

Please enter an optional run_list of common base roles. (example: role[base],role[another]) 
(SKIP to skip, QUIT to cancel)
 > SKIP

Finally, you have a brand new chef broker, ready to be added to your policy:

 Name =>  Chef
 Description =>  Production
 Plugin =>  chef
 UUID =>  7HYCfiyr5LQ13ScnLoRlUB
 Chef Server URL =>  https://chef.example.com:4000
 Chef Version =>  10.16.2
 Validation Key MD5 Hash =>  6372aca0ebceddb65c4e934d35f789c2
 Validation Client Name =>  chef-validator
 Bootstrap Environment =>  _default
 Install Sh Url =>  http://opscode.com/chef/install.sh
 Chef Client Path =>  chef-client
 Base Run List =>

Now, when listing available brokers, you should see your new chef broker in the list:

root@ubuntu:/opt/razor# razor broker
Broker Targets:
 Name   Description  Plugin           UUID           
Chef    Production   chef    7HYCfiyr5LQ13ScnLoRlUB  
puppet  puppet       puppet  11fTD6ejTXmbS4nyIu0ZF5

You can view the details of the broker by specifying it’s UUID:

root@ubuntu:/opt/razor# razor broker 7HYCfiyr5LQ13ScnLoRlUB
 Name =>  Chef
 Description =>  Production
 Plugin =>  chef
 UUID =>  7HYCfiyr5LQ13ScnLoRlUB
 Chef Server URL =>  https://chef.example.com:4000
 Chef Version =>  10.16.2
 Validation Key MD5 Hash =>  6372aca0ebceddb65c4e934d35f789c2
 Validation Client Name =>  chef-validator
 Bootstrap Environment =>  _default
 Install Sh Url =>  http://opscode.com/chef/install.sh
 Chef Client Path =>  chef-client
 Base Run List =>  

root@ubuntu:/opt/razor#
Razor Facts

Besides installing chef client and registering it with the server, Razor also injects custom facts into the new node. I split them out into additional blog post, since there are a few of them!

-eglute

 Posted by at 10:59 pm