From c57bf87e3487b08b57545e86f739279a5ead8bba Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Thu, 16 Nov 2023 21:23:51 +0100 Subject: [PATCH] Simple bundle to edit /etc/hosts --- lib.cf | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib.cf b/lib.cf index 06d4f40..a7e4469 100644 --- a/lib.cf +++ b/lib.cf @@ -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"); +} +