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. Example:
18
19 groups_dbi( 'DBI:mysql:rex;host=db01',
20 user => 'username',
21 password => 'password',
22 sql => "SELECT * FROM HOST",
23 create_all_group => TRUE);
24
25 Database sample for MySQL
26 CREATE TABLE IF NOT EXISTS `HOST` (
27 `ID` int(11) NOT NULL,
28 `GROUP` varchar(255) DEFAULT NULL,
29 `HOST` varchar(255) NOT NULL,
30 PRIMARY KEY (`ID`)
31 );
32
33 Data sample for MySQL
34 INSERT INTO `HOST` (`ID`, `GROUP`, `HOST`) VALUES
35 (1, 'db', 'db01'),
36 (2, 'db', 'db02'),
37 (3, 'was', 'was01'),
38 (4, 'was', 'was02');
39
40
41
42perl v5.36.1 2023-08-07 Rex::Group::Lookup::DBI(3)