Rex::Co...::Augeas(3)
Okay bestie, welcome to Rex::Co...::Augeas(3) β a User Contributed Perl Documentation page for Rex::Commands::Augeas, the augeas module for (R)?ex. It's lowkey iconic, highkey useful, and we're gonna read it together like a group chat π«Ά.
πΈ NAME πΈ
Rex::Commands::Augeas β an augeas module for (R)?ex π
π DESCRIPTION π
This is a simple module to manipulate configuration files with the help of augeas. Short, sweet, and to the point β we love a concise icon, periodt β¨.
β¨ SYNOPSIS β¨
Okay so here's the demo reel, bestie. Vibe check: passed. Watch how it moves:
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";
};
π EXPORTED FUNCTIONS π
π¦ augeas($action, @options) π¦
Bestie, this is the function signature: augeas($action, @options). It returns 1 on success and 0 on failure β no cap.
Actions:
π modify
This modifies the keys given in @options in $file. Slay. Like this:
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-bye, little config node π
augeas remove => "/files/etc/hosts/2",
on_change => sub { say "I changed!" };
π± insert
Insert an item into the file. Here, the order of the options is important. If the order is wrong it won't save your changes.
β οΈ Bestie, listen: the order of the options is important here. If the order is wrong it won't save your changes. Not me being dramatic, that's just the truth fr fr π.
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. It's giving show-and-tell for config files:
augeas dump => "/files/etc/hosts";
π exists
Check if an item exists. Here's the little check:
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. Like:
my $val = augeas get => "/files/etc/hosts/1/ipaddr";
Okay that's the page, bestie π. Cute sign-off time: this was perl v5.42.3, dated 2023-08-05, and it lives under Rex::Co...::Augeas(3). That page ate, iykyk. Mwah! π«Άβ¨
π¦ 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