Compare commits

..

2 Commits

Author SHA1 Message Date
Tobias Herre 71bef3b692 Creates sympa general maps 2023-10-23 11:08:20 +02:00
Tobias Herre 2c5c5f1951 change sql_dir into maps_dir 2023-10-23 11:08:05 +02:00
2 changed files with 56 additions and 9 deletions

View File

@ -47,6 +47,8 @@ vars:
"postmap_cmd" string => "/usr/sbin/postmap"; "postmap_cmd" string => "/usr/sbin/postmap";
any:: any::
"data_dir" string => "$(db_dir)/postfix"; "data_dir" string => "$(db_dir)/postfix";
"maps_dir" string => "$(cfg_dir)/maps";
users: users:
debian:: debian::
@ -69,6 +71,12 @@ files:
create => "true", create => "true",
perms => m(755); perms => m(755);
"$(maps_dir)/."
create => "true",
perms => m("755");
"$(postfix.db_dir)/." "$(postfix.db_dir)/."
create => "true", create => "true",
perms => mog("755","root","root"), perms => mog("755","root","root"),
@ -172,15 +180,15 @@ vars:
"idx" slist => getindices("file"); "idx" slist => getindices("file");
"sql_dir" string => "$(postfix.cfg_dir)/sql"; "maps_dir" string => "$(postfix.cfg_dir)/maps";
"$(idx)" string => "$(sql_dir)/$(idx).sql"; "$(idx)" string => "$(maps_dir)/$(idx).sql";
files: files:
"$(sql_dir)/." "$(maps_dir)/."
create => "true", create => "true",
perms => m("755"); perms => m("755");
"$(sql_dir)/$(idx).sql" "$(maps_dir)/$(idx).sql"
create=>"true", create=>"true",
perms=>m("644"), perms=>m("644"),
content=>" content=>"

View File

@ -140,6 +140,45 @@ reports:
} }
bundle agent sympa_create_postfix_general_maps(cfg,dest_file)
{
vars:
"dl" slist => getindices(@(cfg[domains]));
"cnt" string => string_mustache("
#
# Managed by CFEngine
#
{{#dl}}
sympa@{{.}} sympa:sympa@{{.}}(dl)
listmaster@{{.}}(dl) sympa:listmaster@{{.}}(dl)
bounce@{{.}}(dl) sympa:bounce@{{.}}(dl)
abuse-feedback-report@{{.}} sympa:abuse-feedback-report@{{.}}
{{/dl}}
",
bundlestate("$(this.bundle)"));
classes:
"postfix_repaired" expression => not(fileexists("$(dest_file).db")),
scope => "namespace";
files:
"$(dest_file)"
perms => m("644"),
create => "true",
content => "$(cnt)
",
classes => if_repaired("postfix_repaired"),
handle => "sympa_postfix_general_maps_created" ;
commands:
postfix_repaired::
"$(postfix.postmap_cmd)"
args => "$(dest_file)",
inform => "true",
depends_on => {"sympa_postfix_general_maps_created"};
reports:
}
bundle agent sympa_postfix_sql(cfg) bundle agent sympa_postfix_sql(cfg)
{ {
vars: vars:
@ -152,14 +191,14 @@ vars:
"idx" slist => getindices("file"); "idx" slist => getindices("file");
"sql_dir" string => "$(postfix.cfg_dir)/sql"; "maps_dir" string => "$(postfix.cfg_dir)/sql";
"$(idx)" string => "$(sql_dir)/$(idx).sql"; "$(idx)" string => "$(maps_dir)/$(idx).sql";
files: files:
"$(sql_dir)/." "$(maps_dir)/."
create => "true", create => "true",
perms => m("755"); perms => m("755");
"$(sql_dir)/$(idx).sql" "$(maps_dir)/$(idx).sql"
create=>"true", create=>"true",
perms=>m("644"), perms=>m("644"),
content=>" content=>"
@ -282,7 +321,7 @@ methods:
}; };
# "any" usebundle => install_sympa_domain("@(cfg[domains][$(domains_idx)])"); # "any" usebundle => install_sympa_domain("@(cfg[domains][$(domains_idx)])");
"any" usebundle => install_sympa_domains(@(cfg[domains2])); "any" usebundle => install_sympa_domains(@(cfg[domains]));
reports: reports:
# "IDX $(domains_idx)"; # "IDX $(domains_idx)";
# "DOMCONF: $(cfg[$(idx)])"; # "DOMCONF: $(cfg[$(idx)])";