1Rex::CMDB(3)          User Contributed Perl Documentation         Rex::CMDB(3)
2
3
4

NAME

6       Rex::CMDB - Function to access the CMDB (configuration management
7       database)
8

DESCRIPTION

10       This module exports a function to access a CMDB via a common interface.
11       When the 0.51 feature flag or later is used, the CMDB is enabled by
12       default with Rex::CMDB::YAML as the default provider.
13

SYNOPSIS

15        use Rex::CMDB;
16
17        set cmdb => {
18          type           => 'YAML',
19          path           => [ 'cmdb/{hostname}.yml', 'cmdb/default.yml', ],
20          merge_behavior => 'LEFT_PRECEDENT',
21        };
22
23        task 'prepare', 'server1', sub {
24          my %all_information          = get cmdb;
25          my $specific_item            = get cmdb('item');
26          my $specific_item_for_server = get cmdb( 'item', 'server' );
27        };
28

EXPORTED FUNCTIONS

30   set cmdb
31        set cmdb => {
32          type => 'YAML',
33          %provider_options,
34        };
35
36       Instantiate a specific "type" of CMDB provider with the given options.
37       Returns the provider instance.
38
39       Please consult the documentation of the given provider for their
40       supported options.
41
42   cmdb([$item, $server])
43       Function to query a CMDB.
44
45       If called without arguments, it returns the full CMDB data structure
46       for the current connection.
47
48       If only a defined $item is passed, it returns only the value for the
49       given CMDB item, for the current connection.
50
51       If only a defined $server is passed, it returns the whole CMDB data
52       structure for the given server.
53
54       If both $item and $server are defined, it returns the given CMDB item
55       for the given server.
56
57       The value returned is a Rex::Value, so you may need to use the "get
58       cmdb(...)" form if you'd like to assign the result to a Perl variable:
59
60        task 'prepare', 'server1', sub {
61          my %all_information          = get cmdb;
62          my $specific_item            = get cmdb('item');
63          my $specific_item_for_server = get cmdb( 'item', 'server' );
64        };
65
66       If caching is enabled, this function caches the full data structure for
67       the given server under the "cmdb/$CMDB_PROVIDER/$server" cache key
68       after the first query.
69
70
71
72perl v5.32.1                      2021-03-06                      Rex::CMDB(3)
Impressum