saltstack/salt — Issue #669: add configurable grains
Author: pille
Created: 2012-02-09 19:46:51+00:00
State: open

writing new grains should not be possible only by implementing them in python.
it should become configurable, since most grains are just some sort of "return X, if file Y contains Z".
these simple grains should be defined in a .yml using features like states.file.sed.
the hierarchical YAML-structure should represent the way I would do it with unix-tools and pipes.

a grain that reports the uptime in seconds may be defined:

uptime:
- cut:
- source: /proc/uptime
- delimiter: ' '
- field: 1

which would do something like:

cut -d' ' -f1 /proc/uptime