-
Notifications
You must be signed in to change notification settings - Fork 163
Getting started
This page explains the most important commands for getting started. We assume that you have a Razor server up and running (if not, go to Installation)
To set up the client, you need a 1.9.3 Ruby (MRI is fine for this) and then run the following commands:
```shell
git clone https://github.com/puppetlabs/razor-client
cd razor-client
bundle install
alias razor="$PWD/bin/razor -u http://razor:8080/api"
```
The last command assumes that your Razor server is running on the host razor
.
To use Razor, you will need to create a few basic objects on the server. Most importantly, you'll want to load at least one image into the server and declare a broker:
razor create-image --name=some-os --image-url http://some.where/some-os.iso
All the objects you use with Razor are identified by a name, which has to be unique (i.e., there can only be one image called 'sles-11') The image contains the actual bits that are used when installing a node; the instructions for installation are contained in installers, and Razor comes with a few predefined installers to get you started. They can be found in the installers/
directory in the razor-server
repo.
Besides images and installers, you'll also need a broker; brokers are responsible for handing a node off to a config management system, usually Puppet. We'll set up a simple noop
broker, that does nothing:
razor create-broker --name=noop --broker-type=noop
With that set up, we can create a policy. Policies tie all the other bits and pieces in Razor together, and are what gets ultimately applied to a host. Since a command line to create a policy would be quite a mouthful, we store the policy in a JSON file:
# policy.json
{
"name": "some-os-for-small",
"image": { "name": "some-os" },
"installer": { "name": "some-os-installer" },
"broker": { "name": "noop" },
"enabled": true,
"hostname": "host${id}.example.com",
"root_password": "secret",
"max_count": "20",
"line_number": "100",
"tags": [{ "name": "small", "rule": ["<=", ["fact", "processorcount"], 2]]}]
}
and create it on the server:
razor create-policy --json policy.json
With that, the first 20 nodes with no more than two processors that boot will get the some-os-for-small policy applied to them.
## Investigating what's on your serverRunning razor nodes
will produce a list of all the nodes that the Razor server knows about, and looks something like this:
Id: "http://razor:8080/api/collections/nodes/5254000d97f0"
Name: "5254000d97f0"
Type: "/razor/v1/collections/nodes/member"
... more nodes ...
The name of the node is simply the MAC address of its interface (or those MAC addresses glommed together if the node has more than one interface). It can be used to get more information about the node via razor nodes 5254000d97f0
Id: "http://razor:8080/api/collections/nodes/5254000d97f0"
Name: "5254000d97f0"
Type: "/razor/v1/collections/nodes/member"
Hw_id: "5254000d97f0"
Dhcp_mac: "01-52-54-00-0d-97-f0"
Policy: ...
Log: ...
Facts:
Id: "root"
Architecture: "x86_64"
Kernel: "Linux"
Domain: "localhost"
Macaddress: "52:54:00:0d:97:f0"
...
and razor nodes 5254000d97f0 log
displays the log of that node:
Event: "boot"
Installer: "microkernel"
Template: "boot"
Image: "microkernel"
Timestamp: 1377104696
Severity: "info"
Event: "bind"
Policy: "fedora-for-any"
Timestamp: 1377105312
Severity: "info"
Action: "reboot"
Policy: "fedora-for-any"
Timestamp: 1377105312
Severity: "info"
Event: "boot"
Installer: "redhat"
Template: "boot_install"
Image: "fedora-19"
Timestamp: 1377105319
Severity: "info"
For any of the collections that Razor supports, you can use razor COLLECTION
to get a list of that collection, and razor COLLECTION NAME
to get the details of an object in that collection. Running razor -h
will list all the collections the server knows about.
As an example, razor tags
lists all tags, and razor tags test
shows the details of the tag with name test
.