Compare commits

..

No commits in common. "07aec23f94e4e7effbdcdcddb04627e34c7d8e89" and "d5f1f7f8a03a75e8ff6f83a180c92685eb825ef1" have entirely different histories.

2 changed files with 15 additions and 61 deletions

26
lib.cf
View File

@ -107,35 +107,13 @@ body service_method wmde
bundle agent wmde_service(service_name,start_cond, restart_cond)
{
classes:
freebsd::
"service_running" expression => returnszero("/usr/sbin/service $(service_name) onestatus >/dev/null 2>&1", "useshell");
commands:
"freebsd&(!service_running)&($(start_cond))"::
"/usr/sbin/service"
args => "$(service_name) onestart >/dev/null 2>&1",
contain => wmde_cmd_useshell,
handle => "$(handle)_service_started";
"freebsd&(service_running)&($(start_cond))"::
"/usr/bin/true"
inform => "false",
handle => "$(handle)_service_started";
"freebsd&($(restart_cond))"::
"/usr/sbin/service"
args => "$(service_name) onerestart >/dev/null 2>&1",
contain => wmde_cmd_useshell,
handle => "$(handle)_service_restarted";
services:
"(!freebsd)&($(start_cond))"::
"$(start_cond)"::
"$(service_name)"
service_policy => "start",
handle => "$(handle)_service_started";
"(!freebsd)&($(restart_cond))"::
"$(restart_cond)"::
"$(service_name)"
service_policy => "restart",
handle => "$(handle)_service_restarted";

View File

@ -5,30 +5,12 @@
bundle agent strongswan
{
vars:
freebsd::
"pkgs" slist => {
"strongswan"
};
"ipsec_conf" string => "/usr/local/etc/ipsec.conf";
"ipsec_secrets" string => "/usr/local/etc/ipsec.secrets";
"service_name" string => "strongswan";
debian::
"pkgs" slist => {
"strongswan"
};
"ipsec_conf" string => "/etc/ipsec.conf";
"ipsec_secrets" string => "/etc/ipsec.secrets";
"service_name" string => "ipsec";
centos::
"pkgs" slist => {
"strongswan"
};
"ipsec_conf" string => "/etc/strongswan/ipsec.conf";
"ipsec_secrets" string => "/etc/strongswan/ipsec.secrets";
"service_name" string => "strongswan-starter";
"ipsec_conf" string => "/etc/ipsec.conf";
"ipsec_secrets" string => "/etc/ipsec.secrets";
"service_name" string => "ipsec";
"pkgs" slist => {
"strongswan"
};
}
@ -36,15 +18,15 @@ vars:
bundle agent install_strongswan(cfg)
{
vars:
"service_deps" slist => { "strongswan_ipsec_conf_ready", "strongswan_ipsec_secrets_ready" };
freebsd::
"service_deps" slist => { "strongswan_ipsec_conf_ready", "strongswan_ipsec_secrets_ready","strongswan_bsdcfg_ready" };
"js" string => storejson(@(cfg));
methods:
"any" usebundle => wmde_install_packages(@(strongswan.pkgs),"strongswan");
"any" usebundle => wmde_service("$(strongswan.service_name)","strongswan_kept","strongswan_repaired"),
depends_on => @(service_deps);
depends_on => {
"strongswan_ipsec_conf_ready",
"strongswan_ipsec_secrets_ready"
};
files:
"$(strongswan.ipsec_conf)"
create => "true",
@ -64,14 +46,8 @@ files:
classes => if_repaired("strongswan_repaired"),
edit_template => "$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/strongswan-ipsec.secrets.mustache";
freebsd::
"/etc/rc.conf.d/strongswan"
create => "true",
content =>"strongswan_interface=stroke
strongswan_enable=\"YES\"
",
handle => "strongswan_bsdcfg_ready";
reports:
reports:
}