Skip to content

Instantly share code, notes, and snippets.

#!/var/cfengine/bin/cf-agent -f
body common control {
bundlesequence => { "main" };
}
bundle agent main{
reports:
cfengine::
"I can be executed like a shell script";
@nickanderson
nickanderson / gist:4001312
Created November 2, 2012 13:13 — forked from rpetre/gist:4000674
duplicate selection of variable
infra:~ # cf-agent -KI
!! Duplicate selection of value for variable "missing" in scope dead_hosts
!! Rule from /var/cfengine/inputs/actions/update.cf at/before line 38
!! Duplicate selection of value for variable "missing" in scope dead_hosts
!! Rule from /var/cfengine/inputs/actions/update.cf at/before line 38
-------------------
bundle agent dead_hosts {
vars:
"delay" int => "24";
bundle agent app_dhcpd
{
classes:
"any" expression => regextract(
"([^\n]+)\.([^\n]+)\.([^\n]+)",
"$(sys.ipv4_3[eth0])",
"ip_addr"
);
"=app-backup/rdiff-backup-1.2.8-r1"
package_policy => "add",
package_select => "==",
package_version => "1.2.8-r1",
package_method => generic;

Installation

  1. Copy the contents of masterfiles into your masterfiles or equivalent repository.
  2. Include all EFL .cf files in your inputs list in the common control body. Example:

efl_lib.cf

bundle common efl_lib
{
cat test
$(sys.fqhost)
bundle agent main
{
files:
"/etc/test.tpl"
copy_from => secure_cp("$(g.configfiles)/etc/test", "$(g.host)"),
comment => "We must have a template that we can use to dynamically