1Rex::Group::Lookup::DBIU(s3e)r Contributed Perl DocumentaRteixo:n:Group::Lookup::DBI(3)
2
3
4
6 Rex::Group::Lookup::DBI - read hostnames and groups from a DBI source
7
9 With this module you can define hostgroups out of an DBI source.
10
12 use Rex::Group::Lookup::DBI;
13 groups_dbi "dsn", "user", "password", "SQL request";
14
16 groups_dbi($dsn, $user, $password, $sql)
17 With this function you can read groups from DBI source.
18
19 Example: groups_dbi( 'DBI:mysql:rex;host=db01', user =>
20 'username', password => 'password', sql => "SELECT
21 * FROM HOST", create_all_group => TRUE);
22 Database sample for MySQL
23 CREATE TABLE IF NOT EXISTS `HOST` (
24 `ID` int(11) NOT NULL,
25 `GROUP` varchar(255) DEFAULT NULL,
26 `HOST` varchar(255) NOT NULL,
27 PRIMARY KEY (`ID`)
28 );
29
30 Data sample for MySQL
31 INSERT INTO `HOST` (`ID`, `GROUP`, `HOST`) VALUES
32 (1, 'db', 'db01'),
33 (2, 'db', 'db02'),
34 (3, 'was', 'was01'),
35 (4, 'was', 'was02');
36
37
38
39perl v5.28.0 2017-03-01 Rex::Group::Lookup::DBI(3)