blob: 75da3f1c3aba294b41233d3bf412dce9c7011cd8 [file] [log] [blame]
martin f. krafft8acd49d2013-08-26 21:22:25 +02001==================
2reclass operations
3==================
4
5Data merging
6------------
7While |reclass| has been built to support different storage backends through
8plugins, currently only the ``yaml_fs`` storage backend exists. This is a very
9simple, yet powerful, YAML-based backend, using flat files on the filesystem
10(as suggested by the ``_fs`` postfix).
11
12``yaml_fs`` works with two directories, one for node definitions, and another
13for class definitions. It is possible to use a single directory for both, but
14that could get messy and is therefore not recommended.
15
16Files in those directories are YAML-files, specifying key-value pairs. The
17following three keys are read by |reclass|:
18
19============ ================================================================
20Key Description
21============ ================================================================
22classes a list of parent classes
23appliations a list of applications to append to the applications defined by
24 ancestors. If an application name starts with ``~``, it would
25 remove this application from the list, if it had already been
26 added but it does not prevent a future addition.
27 E.g. ``~firewalled``
28parameters key-value pairs to set defaults in class definitions, override
29 existing data, or provide node-specific information in node
30 specifications.
31 \
32 By convention, parameters corresponding to an application
33 should be provided as subkey-value pairs, keyed by the name of
34 the application, e.g.::
35
36 applications:
37 - ssh.server
38 parameters:
39 ssh.server:
40 permit_root_login: no
41============ ================================================================
42
43|reclass| starts out reading a node definition file, obtains the list of
44classes, then reads the files corresponding to these classes, recursively
45reading parent classes, and finally merges the applications list and the
46parameters.
47
48Merging of parameters is done recursively, meaning that lists and dictionaries
49are extended (recursively), rather than replaced. However, a scalar value
50*does* overwrite a dictionary or list value. While the scalar could be
51appended to an existing list, there is sane default assumption in the context
52of a dictionary, so this behaviour seems the most logical.
53
54Parameter interpolation
55------------------------
56Parameters may reference each other, including deep references, e.g.::
57
58 parameters:
59 location: Munich, Germany
60 motd:
61 header: This node sits in ${location}
62 for_demonstration: ${motd:header}
63 dict_reference: ${motd}
64
65After merging and interpolation, which happens automatically inside the
66storage modules, the ``for_demonstration`` parameter will have a value of
67"This node sits in Munich, Germany".
68
69Types are preserved if the value contains nothing but a reference. Hence, the
70value of ``dict_reference`` will actually be a dictionary.
71
72You should now be ready to :doc:`use reclass <usage>`!
73
74.. include:: substs.inc