Installs also service

This commit is contained in:
Tobias Herre 2023-10-28 14:03:57 +02:00
parent c72ad8ef06
commit 7966a02530
1 changed files with 47 additions and 8 deletions

View File

@ -5,6 +5,8 @@
bundle agent opendkim(cfg_param) bundle agent opendkim(cfg_param)
{ {
vars: vars:
"service_name" string => "opendkim";
debian:: debian::
"pkgs" slist => {"opendkim"}; "pkgs" slist => {"opendkim"};
"uid" string => "opendkim"; "uid" string => "opendkim";
@ -12,6 +14,15 @@ vars:
"cfg_file" string => "/etc/opendkim.conf"; "cfg_file" string => "/etc/opendkim.conf";
#"pid_file" string => "/var/run/opendkim.pid"; #"pid_file" string => "/var/run/opendkim.pid";
"pid_file" string => "/run/opendkim/opendkim.pid"; "pid_file" string => "/run/opendkim/opendkim.pid";
centos::
"pkgs" slist => {"opendkim"};
"uid" string => "opendkim";
"gid" string => "opendkim";
"cfg_file" string => "/etc/opendkim.conf";
#"pid_file" string => "/var/run/opendkim.pid";
"pid_file" string => "/run/opendkim/opendkim.pid";
freebsd:: freebsd::
"pkgs" slist => {"opendkim"}; "pkgs" slist => {"opendkim"};
"uid" string => "mailnull"; "uid" string => "mailnull";
@ -39,23 +50,51 @@ vars:
methods: methods:
"any" usebundle => wmde_install_packages(@(opendkim.pkgs),"opendkim"), "any" usebundle => opendkim_systemd_overrides,
handle => "opendkim_installed"; handle => "opendkim_overrides_done";
"any" usebundle => wmde_install_packages(@(opendkim.pkgs),"opendkim");
"any" usebundle => wmde_service("$(service_name)","opendkim_kept","opendkim_repaired"),
depends_on => {
"opendkim_overrides_done",
"opendkim_pkgs_installed",
"opendkim_cfg_done"
};
files: files:
"$(opendkim.cfg_file)" "$(opendkim.cfg_file)"
create => "true", create => "true",
edit_template => "$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/opendkim.conf.mustache", edit_template => "$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/opendkim.conf.mustache",
template_method => "mustache", template_method => "mustache",
template_data => bundlestate("opendkim"); template_data => bundlestate("opendkim"),
# template_data => mergedata(@(opendkim.default_cfg),@(opendkim.cfg)); classes => if_repaired("opendkim_repaired"),
handle => "opendkim_cfg_done";
reports: reports:
# "HALLO DIKM";
# "MYLEN: $(mynetworks_len)";
# "HEAD: $(mynetworks_head)";
# "TAIL: $(mynetworks_tail)";
} }
bundle agent opendkim_systemd_overrides
{
files:
centos::
"/etc/systemd/system/opendkim.service.d/override.conf"
create => "true",
content => "
[Service]
User=root
Group=root
",
classes => if_repaired("opendkim_repaired"),
handle => "opendkim_systemd_override_created";
commands:
centos&opendkim_repaired::
"/usr/bin/systemctl"
args => "daemon-reload",
depends_on => {"opendkim_systemd_override_created"};
}