.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Rex::CMDB 3pm" .TH Rex::CMDB 3pm "2023-08-09" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Rex::CMDB \- Function to access the CMDB (configuration management database) .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module exports a function to access a \s-1CMDB\s0 via a common interface. When the 0.51 feature flag or later is used, the \s-1CMDB\s0 is enabled by default with Rex::CMDB::YAML as the default provider. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Rex::CMDB; \& \& set cmdb => { \& type => \*(AqYAML\*(Aq, \& path => [ \*(Aqcmdb/{hostname}.yml\*(Aq, \*(Aqcmdb/default.yml\*(Aq, ], \& merge_behavior => \*(AqLEFT_PRECEDENT\*(Aq, \& }; \& \& task \*(Aqprepare\*(Aq, \*(Aqserver1\*(Aq, sub { \& my %all_information = get cmdb; \& my $specific_item = get cmdb(\*(Aqitem\*(Aq); \& my $specific_item_for_server = get cmdb( \*(Aqitem\*(Aq, \*(Aqserver\*(Aq ); \& }; .Ve .SH "EXPORTED FUNCTIONS" .IX Header "EXPORTED FUNCTIONS" .SS "set cmdb" .IX Subsection "set cmdb" .Vb 4 \& set cmdb => { \& type => \*(AqYAML\*(Aq, \& %provider_options, \& }; .Ve .PP Instantiate a specific \f(CW\*(C`type\*(C'\fR of \s-1CMDB\s0 provider with the given options. Returns the provider instance. .PP Please consult the documentation of the given provider for their supported options. .ie n .SS "cmdb([$item, $server])" .el .SS "cmdb([$item, \f(CW$server\fP])" .IX Subsection "cmdb([$item, $server])" Function to query a \s-1CMDB.\s0 .PP If called without arguments, it returns the full \s-1CMDB\s0 data structure for the current connection. .PP If only a defined \f(CW$item\fR is passed, it returns only the value for the given \s-1CMDB\s0 item, for the current connection. .PP If only a defined \f(CW$server\fR is passed, it returns the whole \s-1CMDB\s0 data structure for the given server. .PP If both \f(CW$item\fR and \f(CW$server\fR are defined, it returns the given \s-1CMDB\s0 item for the given server. .PP The value returned is a Rex::Value, so you may need to use the \f(CW\*(C`get cmdb(...)\*(C'\fR form if you'd like to assign the result to a Perl variable: .PP .Vb 5 \& task \*(Aqprepare\*(Aq, \*(Aqserver1\*(Aq, sub { \& my %all_information = get cmdb; \& my $specific_item = get cmdb(\*(Aqitem\*(Aq); \& my $specific_item_for_server = get cmdb( \*(Aqitem\*(Aq, \*(Aqserver\*(Aq ); \& }; .Ve .PP If caching is enabled, this function caches the full data structure for the given server under the \f(CW\*(C`cmdb/$CMDB_PROVIDER/$server\*(C'\fR cache key after the first query.