Some useful bundles added
This commit is contained in:
parent
e96d178b94
commit
648b60bbbb
103
lib.cf
103
lib.cf
|
@ -7,7 +7,108 @@ body perms uperm(user,group,mode)
|
||||||
mode => "$(mode)";
|
mode => "$(mode)";
|
||||||
rxdirs => "false";
|
rxdirs => "false";
|
||||||
groups => { "$(group)" };
|
groups => { "$(group)" };
|
||||||
owners => { "$(user)" };
|
owners => { "$(user)" };
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# wmdelib.cf
|
||||||
|
#
|
||||||
|
|
||||||
|
bundle agent wmde_install_packages(pkgs,name)
|
||||||
|
{
|
||||||
|
packages:
|
||||||
|
freebsd::
|
||||||
|
"$(pkgs)"
|
||||||
|
policy => "present",
|
||||||
|
package_module => pkg,
|
||||||
|
classes => if_repaired("$(name)_repaired"),
|
||||||
|
classes => if_ok("$(name)_ok");
|
||||||
|
debian::
|
||||||
|
"$(pkgs)"
|
||||||
|
policy => "present",
|
||||||
|
package_module => apt_get,
|
||||||
|
classes => if_repaired("$(name)_repaired"),
|
||||||
|
classes => if_ok("$(name)_ok");
|
||||||
|
}
|
||||||
|
|
||||||
|
body perms wmde_perms(user,group,mode)
|
||||||
|
{
|
||||||
|
owners => { "$(user)" };
|
||||||
|
groups => { "$(group)" };
|
||||||
|
mode => "$(mode)";
|
||||||
|
rxdirs=>"false";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bundle agent wmde_srv(service_name,cmd)
|
||||||
|
{
|
||||||
|
|
||||||
|
classes:
|
||||||
|
"start" expression => strcmp("start","$(cmd)");
|
||||||
|
"restart" expression => strcmp("restart",cmd);
|
||||||
|
|
||||||
|
|
||||||
|
commands:
|
||||||
|
freebsd::
|
||||||
|
"/bin/sh"
|
||||||
|
args => "-c '/usr/sbin/service $(service_name) onestatus > /dev/null && echo +$(service_name)_running || echo -$(service_name)_running'",
|
||||||
|
inform => "false",
|
||||||
|
module => "true",
|
||||||
|
handle => "$(service_name)_status_tested";
|
||||||
|
|
||||||
|
"!$(service_name)_running&start"::
|
||||||
|
"/bin/sh"
|
||||||
|
args => "-c '/usr/sbin/service $(service_name) onestart 2> /dev/null > /dev/null && echo +$(service_name)_started || echo -$(service_name)_started'",
|
||||||
|
module => "true",
|
||||||
|
depends_on => {"$(service_name)_status_tested"};
|
||||||
|
|
||||||
|
"!$(service_name)_running&restart"::
|
||||||
|
"/bin/sh"
|
||||||
|
args => "-c '/usr/sbin/service $(service_name) onerestart 2> /dev/null > /dev/null && echo +$(service_name)_started || echo -$(service_name)_started'",
|
||||||
|
module => "true",
|
||||||
|
depends_on => {"$(service_name)_status_tested"};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
reports:
|
||||||
|
start::
|
||||||
|
# "MUST START";
|
||||||
|
!start::
|
||||||
|
# "MUST NOT START";
|
||||||
|
|
||||||
|
# running::
|
||||||
|
# "Server $(service_name) - running";
|
||||||
|
# !running::
|
||||||
|
# "Server $(service_name) - not running";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
body service_method wmde
|
||||||
|
{
|
||||||
|
service_type => "generic";
|
||||||
|
service_bundle => wmde_srv ($(this.promiser), $(this.service_policy));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bundle agent wmde_service(service_name,start_cond, restart_cond)
|
||||||
|
{
|
||||||
|
services:
|
||||||
|
"$(start_cond)"::
|
||||||
|
"$(service_name)"
|
||||||
|
service_policy => "start";
|
||||||
|
|
||||||
|
"$(restart_cond)"::
|
||||||
|
"$(service_name)"
|
||||||
|
service_policy => "restart";
|
||||||
|
reports:
|
||||||
|
"SERVICE $(service_name) - Start on: $(start_cond) Restart if: $(restart_cond)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue