Skip to content

"yamlfile" module file spec

erikwb edited this page Dec 2, 2011 · 5 revisions

The "yamlfile" module included with libcrange allows you to specify clusters using a directory full of yaml files. To use this module, put "loadmodule yamlfile" in /etc/range.conf.

By default, it looks in /etc/range/*.yaml for these files. Each cluster is represented by one file named CLUSTER.yaml, where CLUSTER is the name of the cluster you want. These YAML files should consist of a single toplevel dictionary - keynames of this dictionary become keys of the cluster, and values should be either YAML lists of range expressions or scalar range expressions. Lists will be and-ed together to produce the final result. Recursive lookups are allowed - you can have a value that refers to another %cluster:KEY, for example.

Example:

$ cat /etc/range/test.yaml
CLUSTER: host1..100.test.com
APPS: 
  - frontend
  - backend
  - mysql

This will give you a cluster called "test" with two keys, CLUSTER and APPS. To access these keys:

$ eh %test:CLUSTER
host1..100.test.com

$ eh %test:APPS
frontend,backend,mysql

CLUSTER is a default key - if you don't ask for any :KEY at all, you'll get it.

$ eh %test
host1..100.test.com

You can additionally list the keys that are defined with :KEYS. This is the only magically defined key.

$ eh %test:KEYS
CLUSTER
APPS

You can additionally do reverse-lookups on these keys.

$ eh 'has(APPS;mysql)'
test
Clone this wiki locally