Simple bundle to edit /etc/hosts

This commit is contained in:
Charlie Root 2023-11-16 21:23:51 +01:00
parent 5c7dad802e
commit c57bf87e34
1 changed files with 16 additions and 1 deletions

17
lib.cf
View File

@ -336,7 +336,7 @@ files:
perms => mog ("$(prms[m])","$(prms[o])","$(prms[g])");
methods:
wget::
"any" usebundle => "install_wget", handle=>"wget_installed";
"any" usebundle => "install_wget"; #, handle=>"wget_installed";
commands:
run_wget::
@ -393,3 +393,18 @@ commands:
args => "-a";
}
bundle agent etc_hosts(hosts)
{
vars:
"idx" slist => getindices(@(hosts));
"settings[$(idx)]" string => "$(hosts[$(idx)])";
files:
"/etc/hosts"
create => "true",
perms => m("644"),
edit_line => set_config_values("$(this.bundle).settings"),
classes => results("namespace","etc_hosts");
}