Rex::Gr...p::YAML(3)

πŸ“¦ version 1.14.3, in nixos 26.05, nixpkgs unstable

πŸ’… Rex::Gr...p::YAML(3)

okay so first things first, the manual name is User Contributed Perl Documentation β€” that's the whole family this little icon belongs to, and the module's actual government name is Rex::Group::Lookup::YAML.


✨ NAME ✨

Rex::Group::Lookup::YAML β€” bestie, this is the module that reads hostnames and groups straight out of a YAML file. no cap. πŸŽ€

🌸 DESCRIPTION 🌸

With this module you can define hostgroups out of an yaml file. that's it, that's the vibe β€” your YAML holds the groups, this thing goes and gets them. it's giving "let the config file do the talking" energy fr fr πŸ’–

πŸ¦‹ SYNOPSIS πŸ¦‹

the whole flex, in two lines:

use Rex::Group::Lookup::YAML;
groups_yaml "file.yml";

like. that's literally it. iconic behavior. ✨

πŸ‘‘ EXPORTED FUNCTIONS πŸ‘‘

πŸ’« groups_yaml($file, create_all_group => $boolean )

so this function is the main character here β€” you use it to read groups from yaml files. there's also an optional create_all_group option you can pass in, and if you set it to "true", then the group all gets created too, and it includes every single host. everyone invited to the party, no exceptions. 🫢

let's look at it in the wild:

# in my_groups.yml
webserver:
 - fe01
 - fe02
 - f03
backends:
 - be01
 - be02
 - f03

# in Rexfile

groups_yaml('my_groups.yml');

# or
groups_yaml('my_groups.yml', create_all_group => TRUE);

see how f03 is lowkey in both groups? that's not a typo bestie, that's just how the example is written β€” copy those names exactly, character for character, or the vibe check will fail πŸ’€


ngl the whole thing is like, three lines of setup and then you're slaying with hostgroups. do it once in your Rexfile and never look back. 🧚

and that's the page!! brought to you by perl v5.42.3 and dated 2023-08-05 β€” ok bye, go define some groups πŸ’œπŸŒˆβ­

πŸ“¦ where this page comes from