Skip to content

Instantly share code, notes, and snippets.

vars:
"svc_states[smb]" string => "on";
"svc_states[nmb]" string => "on";
"services" slist => getindices("svc_states");
methods:
"any" usebundle => service_startup("$(services)","$(svc_states[$(services)])");
@gbkersey
gbkersey / gist:4667602
Created January 29, 2013 20:40
check to see if a package is installed (rpm based)
packages:
"gpg-pubkey"
comment => "Check to see if gpg key for virtualbox repo is installed",
package_policy => "verify",
package_version => "98ab5139-4bf2d0b0",
package_method => rpm_version("/dev/null"),
classes => if_notkept("install_virtualbox_repo_key");
@gbkersey
gbkersey / gist:4656539
Created January 28, 2013 15:39
distribute zabbix
bundle agent app_zabbix
{
vars:
# daemons to run
"svc_states[zabbix_agentd]" string => "on";
"services" slist => getindices("svc_states");
# template files
bundle agent app_foobar
{
files:
"/etc/passwd"
comment => "ensure +:::::: is the last line in /etc/passwd",
edit_line => append_to_passwd;
}
bundle agent app_dhcpd
{
classes:
"any" expression => regextract(
"([^\n]+)\.([^\n]+)\.([^\n]+)",
"$(sys.ipv4_3[$(interface)])",
"ip_addr"
);
vars:
@gbkersey
gbkersey / app_dhcpd.cf
Last active May 1, 2019 00:36
dhcpd control via cfengine
bundle agent app_dhcpd
{
classes:
"any" expression => regextract(
"([^\n]+)\.([^\n]+)\.([^\n]+)\.",
"$(sys.ipv4_3[eth0])",
"ip_addr"
);