RexOps / Rex

Rex, the friendly automation framework
https://www.rexify.org
716 stars 223 forks source link

support dynamic cmdb path expansions (custom macros) #1202

Open ehuelsmann opened 6 years ago

ehuelsmann commented 6 years ago

The idea is to support something along the lines of

set cmdb => {
    type => "YAML",
    merge_behavior => 'LEFT_PRECEDENT',
    path => [
        "cmdb/{environment}/{server}.yml",
        "cmdb/{environment}/default.yml",
        "cmdb/{roles}.yml",
        "cmdb/{server}.yml",
        "cmdb/default.yml",
        ],
};

Notice the {roles} macro, which is taken from the CMDB YAML files read before that specific expansion pattern.

This pattern could be considered an "include" mechanism due to the merging behaviour of the CMDB YAML combination (dynamic includes); which yaml doesn't specify in its format specification.

ferki commented 4 years ago

Dumping some thoughts for implementation details:

I can imagine the first iteration to be a (quite) restricted set of the whole problem domain, and just gradually adding complexity as we explore the desired direction and features.