Rex::Gr...kup::DBI(3)
π Rex::Group::Lookup::DBI(3) π
okay so bestie, this is the manual for Rex::Group::Lookup::DBI, straight from the User Contributed Perl Documentation corner of the universe. It's giving "tiny module, big hostgroup energy" and we're gonna read it together.
πΈ NAME πΈ
Rex::Group::Lookup::DBI β read hostnames and groups from a DBI source. no cap, that's the whole name vibe.
β¨ DESCRIPTION β¨
With this module you can define hostgroups out of a DBI source. That's it, that's the flex. π
π¦ SYNOPSIS π¦
use Rex::Group::Lookup::DBI;
groups_dbi "dsn", "user", "password", "SQL request";
π«Ά EXPORTED FUNCTIONS π«Ά
π groups_dbi($dsn, $user, $password, $sql) π
This function is how you read groups from a DBI source. Here's the example from the page, with all its named args and the create_all_group => TRUE moment:
groups_dbi( 'DBI:mysql:rex;host=db01',
user => 'username',
password => 'password',
sql => "SELECT * FROM HOST",
create_all_group => TRUE);
ποΈ Database sample for MySQL ποΈ
Need a table to make it make sense? This is the sample, exactly as written:
CREATE TABLE IF NOT EXISTS `HOST` (
`ID` int(11) NOT NULL,
`GROUP` varchar(255) DEFAULT NULL,
`HOST` varchar(255) NOT NULL,
PRIMARY KEY (`ID`)
);
π Data sample for MySQL π
And here's the data sample, also exactly as written β look at those little rows go:
INSERT INTO `HOST` (`ID`, `GROUP`, `HOST`) VALUES
(1, 'db', 'db01'),
(2, 'db', 'db02'),
(3, 'was', 'was01'),
(4, 'was', 'was02');
Source/version + date sign-off, because we don't leave the footer hanging: this page is rockin' perl v5.42.3, dated 2023-08-05, and it's the manual for Rex::Gr...kup::DBI(3). bye bestie, go read some groups πβ¨
π¦ where this page comes from
- nixos 26.05: perl5.42.3-Rex 1.14.3
- nixpkgs unstable: perl5.42.3-Rex 1.14.3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms