https://github.com/vvelox/rex-cmdb-yamlwithroles
https://github.com/vvelox/rex-cmdb-yamlwithroles
Last synced: 15 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/vvelox/rex-cmdb-yamlwithroles
- Owner: VVelox
- License: apache-2.0
- Created: 2023-12-21T18:57:10.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-24T07:44:09.000Z (over 1 year ago)
- Last Synced: 2025-02-17T01:42:23.964Z (3 months ago)
- Language: Perl
- Size: 25.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
# Rex-CMDB-YAMLwithRoles
YAML based CMDB provider for Rex with support for roles.
```perl
use Rex::CMDB;
set cmdb => {
type => 'YAMLwithRoles',
merge_behavior => 'LEFT_PRECEDENT',
path => 'path/to/cmdb',
use_roles => 1,
};task 'prepare', 'server1', sub {
my $all_information = get cmdb;
my $specific_item = get cmdb('item');
my $specific_item_for_server = get cmdb( 'item', 'server' );
};
```# ROLES
If use_roles has been set to true, when loading a config file, it will
check for value 'roles' and if that value is a array, it will then go
through and look foreach of those roles under the roles_path.So lets say we have the config below.
```yaml
foo: "bar"
ping: "no"
roles:
- 'test'
```It will then load look under the roles_path for the file 'test.yaml', which with
the default settings would be 'cmdb/roles/test.yaml'.Lets say we have the the role file set as below.
```yaml
ping: "yes"
ping_test:
misses: 3
```This means with the value for ping will be 'no' as the default of
'yes' is being overriden by the config value.Somethings to keep in mind when using this.
- 1: Don't define a value you intend to use in a role in any of the
config files that will me merged unless you want it to always
override anything a role may import. So with like the example above,
you would want to avoid putting ping='no' in the default yaml file
and only set it if you want to override that role in like the yaml
config for that host.- 2: Roles may not include roles. While it won't error or the like,
they also won't be reeled in.