Rex::G...up::DBI(3pm)

πŸ’– Rex::Group::Lookup::DBI πŸ’–

okay bestie, so this is Rex::Group::Lookup::DBI β€” a lil Perl module that lives under the User Contributed Perl Documentation umbrella (3pm section, iykyk) 🫢


✨ NAME ✨

Rex::Group::Lookup::DBI β€” read hostnames and groups from a DBI source 🌸


πŸ¦‹ DESCRIPTION πŸ¦‹

With this module you can define hostgroups out of an DBI source. that's it, that's the vibe πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

use Rex::Group::Lookup::DBI;
groups_dbi "dsn", "user", "password", "SQL request";

🌈 EXPORTED FUNCTIONS 🌈

πŸ‘‘ groups_dbi($dsn, $user, $password, $sql)

With this function you can read groups from DBI source. Example, periodt:

groups_dbi( 'DBI:mysql:rex;host=db01',
  user             => 'username',
  password         => 'password',
  sql              => "SELECT * FROM HOST",
  create_all_group => TRUE);

πŸ“ Database sample for MySQL

no cap, here's the table shape you want:

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 what the rows lowkey look like:

INSERT INTO `HOST` (`ID`, `GROUP`, `HOST`) VALUES
  (1, 'db', 'db01'),
  (2, 'db', 'db02'),
  (3, 'was', 'was01'),
  (4, 'was', 'was02');

hope that helped bestie, go slay your hostgroups πŸ’–βœ¨

this page rode in with perl v5.40.1, dated 2025-10-03, and it's serving Rex::G...up::DBI(3pm) energy β€” mwah, iconic, bye πŸ’…

πŸ“¦ where this page comes from