Rex::C...:Augeas(3pm)
π Rex::Commands::Augeas β the manual, but make it cute π
okay bestie, so you found yourself in the Rex::C...:Augeas(3pm) page from the User Contributed Perl Documentation, and honestly? you're gonna eat this one up. it's a (R)?ex module. yes, really. let's go. π¦
β¨ NAME β¨
Rex::Commands::Augeas β an augeas module for (R)?ex π
πΈ DESCRIPTION πΈ
so basically, this is a simple lil module that lets you manipulate configuration files with the help of augeas. that's the whole vibe. no cap. π
π SYNOPSIS π
here's the energy upfront, bestie β look at these:
my $k = augeas exists => "/files/etc/hosts/*/ipaddr", "127.0.0.1";
augeas insert => "/files/etc/hosts",
label => "01",
after => "/7",
ipaddr => "192.168.2.23",
canonical => "test";
augeas dump => "/files/etc/hosts";
augeas modify =>
"/files/etc/ssh/sshd_config/PermitRootLogin" => "without-password",
on_change => sub {
service ssh => "restart";
};
periodt. now let's get into the actual functions. π₯
β EXPORTED FUNCTIONS β
π«Ά augeas($action, @options)
the way that this one function does *everything*β¦ main character energy fr fr. it returns 1 on success and 0 on failure. that's it, that's the contract. π
Actions:
π§ modify
this modifies the keys given in @options in $file. it's giving glow-up. β¨
augeas modify =>
"/files/etc/hosts/7/ipaddr" => "127.0.0.2",
"/files/etc/hosts/7/canonical" => "test01",
on_change => sub { say "I changed!" };
π remove
Remove an entry. bye bestie, you won't be missed. π
augeas remove => "/files/etc/hosts/2",
on_change => sub { say "I changed!" };
π insert
Insert an item into the file. and listen β here, the order of the options is important. if the order is wrong it won't save your changes. so don't be chaotic about it, okay? π
augeas insert => "/files/etc/hosts",
label => "01",
after => "/7",
ipaddr => "192.168.2.23",
alias => "test02",
on_change => sub { say "I changed!" };
π dump
Dump the contents of a file to STDOUT. no thoughts, just output. π
augeas dump => "/files/etc/hosts";
π₯ exists
Check if an item exists. vibe check, but for entries.
my $exists = augeas exists => "/files/etc/hosts/*/ipaddr" => "127.0.0.1";
if($exists) {
say "127.0.0.1 exists!";
}
π get
Returns the value of the given item. give me what I want, literally. π
my $val = augeas get => "/files/etc/hosts/1/ipaddr";
π ok that's the whole page, you're officially certified in augeas-ing. slay, ily, go configure something.
and for the record books, this was perl v5.40.1, dated 2025-10-03, and it lives on the Rex::C...:Augeas(3pm) page. mwah. π
β¨
π¦ where this page comes from
- ubuntu resolute: rex 1.16.1-1 Β· Apache-2.0
- ubuntu stonking: rex 1.16.1-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms