2023-10-21 20:08:35 +00:00
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
bundle agent sympa
|
|
|
|
{
|
|
|
|
classes:
|
|
|
|
"sympa_b";
|
|
|
|
|
|
|
|
vars:
|
2023-10-31 16:22:50 +00:00
|
|
|
"user" string => "sympa";
|
|
|
|
"group" string => "sympa";
|
|
|
|
|
|
|
|
|
2023-10-27 23:10:53 +00:00
|
|
|
debian::
|
2023-10-21 20:08:35 +00:00
|
|
|
"lib_dir" string => "/usr/lib/sympa";
|
|
|
|
"var_lib_dir" string => "/var/lib/sympa";
|
|
|
|
"share_dir" string => "/usr/share/sympa";
|
|
|
|
"conf_dir" string => "/etc/sympa";
|
|
|
|
"sympa_conf" string => "$(conf_dir)/sympa/sympa.conf";
|
|
|
|
"service_name" string => "sympa";
|
|
|
|
"wwservice_name" string => "wwsympa";
|
|
|
|
"wwsympa_socket" string => "/var/run/sympa/wwsympa.socket";
|
|
|
|
"sympa_pl_cmd" string => "/usr/bin/sympa";
|
|
|
|
|
|
|
|
"pkgs" slist => {
|
|
|
|
"sympa"
|
|
|
|
};
|
|
|
|
|
2023-10-27 23:10:53 +00:00
|
|
|
centos::
|
|
|
|
"lib_dir" string => "/usr/lib/sympa";
|
|
|
|
"var_lib_dir" string => "/var/lib/sympa";
|
|
|
|
"share_dir" string => "/usr/share/sympa";
|
|
|
|
"conf_dir" string => "/etc/sympa";
|
2023-10-29 19:14:15 +00:00
|
|
|
"sympa_conf" string => "$(conf_dir)/sympa.conf";
|
2023-10-27 23:10:53 +00:00
|
|
|
"service_name" string => "sympa";
|
|
|
|
"wwservice_name" string => "wwsympa";
|
|
|
|
"wwsympa_socket" string => "/var/run/sympa/wwsympa.socket";
|
2023-10-29 19:14:15 +00:00
|
|
|
"sympa_pl_cmd" string => "/usr/sbin/sympa.pl";
|
2023-10-27 23:10:53 +00:00
|
|
|
|
|
|
|
"pkgs" slist => {
|
2023-10-29 19:49:47 +00:00
|
|
|
"sympa",
|
|
|
|
"sympa-httpd"
|
2023-10-27 23:10:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-21 20:08:35 +00:00
|
|
|
|
|
|
|
debian&sympa_s::
|
|
|
|
"install_dir" string => "/usr/local/sympa";
|
|
|
|
"queue_cmd" string => "$(install_dir)/bin/queue";
|
|
|
|
"bouncequeue_cmd" string => "$(install_dir)/bin/bouncequeue";
|
|
|
|
|
|
|
|
"static_content_dir" string => "$(install_dir)/static_content";
|
|
|
|
"css_dir" string => "$(static_content_dir)/css";
|
|
|
|
"pictures_dir" string => "$(static_content_dir)/pictures";
|
|
|
|
|
|
|
|
any::
|
|
|
|
|
|
|
|
|
|
|
|
"queue_cmd" string => "$(lib_dir)/bin/queue";
|
|
|
|
"bouncequeue_cmd" string => "$(lib_dir)/bin/bouncequeue";
|
|
|
|
|
|
|
|
|
|
|
|
"static_content_dir" string => "$(share_dir)/static_content";
|
|
|
|
"pictures_dir" string => "$(static_content_dir)/pictures";
|
|
|
|
"css_dir" string => "$(var_lib_dir)/css";
|
|
|
|
|
|
|
|
"sendmail_aliases" string => "$(conf_dir)/sympa_transport";
|
|
|
|
|
|
|
|
"postfix_master_cfg" string => readfile("$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/sympa/postfix-master-cfg.mustache");
|
|
|
|
|
|
|
|
"apache_cfg" string =>
|
|
|
|
"
|
|
|
|
<IfModule mod_proxy_fcgi.c>
|
|
|
|
|
|
|
|
Alias /css-sympa $(sympa.css_dir)
|
|
|
|
Alias /pictures-sympa $(sympa.pictures_dir)
|
|
|
|
Alias /static-sympa $(sympa.static_content_dir)
|
|
|
|
|
|
|
|
<Directory $(sympa.static_content_dir)>
|
|
|
|
Require all granted
|
|
|
|
</Directory>
|
|
|
|
|
|
|
|
<Directory $(sympa.css_dir)>
|
|
|
|
Require all granted
|
|
|
|
</Directory>
|
|
|
|
|
|
|
|
<Directory $(sympa.pictures_dir)>
|
|
|
|
Require all granted
|
|
|
|
</Directory>
|
|
|
|
|
|
|
|
<LocationMatch \\\"^/(?!.*-sympa)\\\">
|
|
|
|
SetHandler \\\"proxy:unix:$(sympa.wwsympa_socket)|fcgi://\\\"
|
|
|
|
Require all granted
|
|
|
|
</LocationMatch>
|
|
|
|
|
|
|
|
</IfModule>
|
|
|
|
|
|
|
|
";
|
|
|
|
|
|
|
|
|
|
|
|
reports:
|
|
|
|
# "MUSTACHE: $(postfix_master_cfg_m)";
|
|
|
|
# "RF: $(sys.workdir)/inputs/$(wmde_lib)/templates/sympa-postfix-master-cfg.mustache";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bundle agent sympa_init_db(cfg)
|
|
|
|
{
|
|
|
|
classes:
|
|
|
|
"run_backups" expression => isvariable("cfg[backup_dir]");
|
|
|
|
|
|
|
|
run_backups::
|
|
|
|
"sql_backup_exists" expression => fileexists("$(cfg[backup_dir])/sympa.sql");
|
|
|
|
|
|
|
|
methods:
|
|
|
|
"any" usebundle => mysql_table_exists(@(cfg[db_settings]),"user_table");
|
|
|
|
|
|
|
|
run_backups::
|
|
|
|
"any" usebundle => restore_mysql_db(@(cfg[db_settings]),"$(cfg[backup_dir])/sympa.sql"),
|
|
|
|
depends_on => {"sympa_config_updated"},
|
|
|
|
if => "sql_backup_exists&(!mysql_sympa_user_table_exists)",
|
|
|
|
handle => "sympa_db_initialized";
|
|
|
|
commands:
|
|
|
|
"!mysql_sympa_user_table_exists"::
|
|
|
|
"$(sympa.sympa_pl_cmd)"
|
|
|
|
args => "--health_check",
|
|
|
|
handle => "sympa_db_initialized",
|
|
|
|
depends_on => {"sympa_config_updated"};
|
|
|
|
|
|
|
|
|
2023-10-31 16:22:50 +00:00
|
|
|
# Configure Backup stuff
|
|
|
|
files:
|
|
|
|
run_backups::
|
|
|
|
"$(cfg[backup_dir])/."
|
|
|
|
create => "true";
|
|
|
|
methods:
|
|
|
|
run_backups::
|
|
|
|
"any" usebundle => create_mysql_backup_cron_job(@(cfg[db_settings]),"$(cfg[backup_dir])/sympa.sql","user_table","true");
|
|
|
|
!run_backups::
|
|
|
|
"any" usebundle => create_mysql_backup_cron_job(@(cfg[db_settings]),"$(cfg[backup_dir])/sympa.sql","user_table","false");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-21 20:08:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bundle agent sympa_create_postfix_maps
|
|
|
|
{
|
|
|
|
classes:
|
|
|
|
"sympa_run_postmap" expression => not(fileexists("$(sympa.sendmail_aliases).db"));
|
|
|
|
files:
|
|
|
|
"$(sympa.sendmail_aliases)"
|
|
|
|
create => "true",
|
|
|
|
classes => if_repaired("sympa_run_postmap"),
|
|
|
|
perms => mog("644","sympa","sympa"),
|
|
|
|
handle => "sympa_sendmail_aliases_created";
|
|
|
|
|
|
|
|
"$(sympa.conf_dir)/list_aliases.tt2"
|
|
|
|
create => "true",
|
|
|
|
copy_from => local_dcp("$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/sympa/list_aliases.tt2.mustache"),
|
|
|
|
perms => mog("644","sympa","sympa");
|
|
|
|
|
|
|
|
commands:
|
|
|
|
"sympa_run_postmap"::
|
|
|
|
"$(postfix.postmap_cmd)"
|
|
|
|
args => "$(sympa.sendmail_aliases)",
|
|
|
|
classes => if_repaired("postfix_repaired"),
|
|
|
|
depends_on => {"sympa_sendmail_aliases_created"};
|
|
|
|
reports:
|
2023-10-22 11:44:51 +00:00
|
|
|
# "create maps";
|
|
|
|
# "sympa_sendmail_aliases_repaired"::
|
|
|
|
# "POSTMAP CALL";
|
2023-10-21 20:08:35 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-10-23 09:08:20 +00:00
|
|
|
bundle agent sympa_create_postfix_general_maps(cfg,dest_file)
|
|
|
|
{
|
|
|
|
vars:
|
|
|
|
"dl" slist => getindices(@(cfg[domains]));
|
|
|
|
|
|
|
|
"cnt" string => string_mustache("
|
|
|
|
#
|
|
|
|
# Managed by CFEngine
|
|
|
|
#
|
|
|
|
{{#dl}}
|
2023-10-26 22:10:44 +00:00
|
|
|
sympa@{{.}} sympa:sympa@{{.}}
|
|
|
|
listmaster@{{.}} sympa:listmaster@{{.}}
|
|
|
|
bounce@{{.}} sympabounce:bounce@{{.}}
|
|
|
|
abuse-feedback-report@{{.}} sympabounce:abuse-feedback-report@{{.}}
|
2023-10-23 09:08:20 +00:00
|
|
|
{{/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:
|
|
|
|
}
|
|
|
|
|
2023-10-21 20:08:35 +00:00
|
|
|
bundle agent sympa_postfix_sql(cfg)
|
|
|
|
{
|
|
|
|
vars:
|
|
|
|
"file[sympa_virtual_mailbox_maps]" string => "query = SELECT 'present' FROM list_table WHERE name_list='%u'
|
|
|
|
or name_list = replace('%u', '-request', '')
|
|
|
|
or name_list = replace('%u', '-editor', '')
|
|
|
|
or name_list = replace('%u', '-subscribe', '')
|
|
|
|
or name_list = replace('%u', '-unsubscribe', '')
|
|
|
|
";
|
|
|
|
|
|
|
|
"idx" slist => getindices("file");
|
|
|
|
|
2023-10-23 09:08:20 +00:00
|
|
|
"maps_dir" string => "$(postfix.cfg_dir)/sql";
|
|
|
|
"$(idx)" string => "$(maps_dir)/$(idx).sql";
|
2023-10-21 20:08:35 +00:00
|
|
|
files:
|
2023-10-23 09:08:20 +00:00
|
|
|
"$(maps_dir)/."
|
2023-10-21 20:08:35 +00:00
|
|
|
create => "true",
|
|
|
|
perms => m("755");
|
|
|
|
|
2023-10-23 09:08:20 +00:00
|
|
|
"$(maps_dir)/$(idx).sql"
|
2023-10-21 20:08:35 +00:00
|
|
|
create=>"true",
|
|
|
|
perms=>m("644"),
|
|
|
|
content=>"
|
|
|
|
user = $(cfg[db_user])
|
|
|
|
password = $(cfg[db_pass])
|
|
|
|
hosts = $(cfg[db_host])
|
|
|
|
dbname = $(cfg[db_name])
|
|
|
|
$(file[$(idx)])
|
|
|
|
";
|
|
|
|
|
|
|
|
reports:
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bundle agent sympa_update_config(cfg)
|
|
|
|
{
|
|
|
|
vars:
|
|
|
|
"default_settings" data => '{
|
|
|
|
"aliases_db_type":"hash",
|
|
|
|
"aliases_program":"$(postfix.postmap_cmd)",
|
|
|
|
"sendmail_aliases":"$(sympa.sendmail_aliases)",
|
|
|
|
"db_type":"$(cfg[db_settings][db_type])",
|
|
|
|
"db_name":"$(cfg[db_settings][db_name])",
|
|
|
|
"db_host":"$(cfg[db_settings][db_host])",
|
|
|
|
"db_passwd":"$(cfg[db_settings][db_pass])",
|
2023-10-29 19:14:15 +00:00
|
|
|
"db_user":"$(cfg[db_settings][db_user])",
|
|
|
|
"css_url":"/css-sympa",
|
|
|
|
"static_content_url":"/static-sympa"
|
2023-10-21 20:08:35 +00:00
|
|
|
|
|
|
|
}';
|
|
|
|
|
|
|
|
"settings_data" data => mergedata(@(default_settings),@(cfg[settings]));
|
|
|
|
|
|
|
|
"idx" slist => getindices(@(settings_data));
|
|
|
|
"settings[$(idx)]" string => "$(settings_data[$(idx)])";
|
|
|
|
|
|
|
|
files:
|
|
|
|
"$(sympa.sympa_conf)"
|
|
|
|
edit_line => set_config_values("$(this.bundle).settings"),
|
|
|
|
handle => "sympa_config_updated",
|
|
|
|
classes => if_repaired("sympa_repaired"),
|
|
|
|
depends_on => { "sympa_pkgs_installed" };
|
|
|
|
|
|
|
|
reports:
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-11-03 07:55:37 +00:00
|
|
|
bundle agent install_sympa_domain(domain,data,conf_dir)
|
2023-10-21 20:08:35 +00:00
|
|
|
{
|
|
|
|
vars:
|
|
|
|
"default_settings" data => '{
|
|
|
|
}';
|
|
|
|
|
|
|
|
"settings_data" data => mergedata(@(default_settings),@(data[settings]));
|
|
|
|
|
|
|
|
"idx" slist => getindices(@(settings_data));
|
|
|
|
"settings[$(idx)]" string => "$(settings_data[$(idx)])";
|
|
|
|
"settings[domain]" string => "$(domain)";
|
|
|
|
|
|
|
|
files:
|
2023-11-03 07:55:37 +00:00
|
|
|
"$(conf_dir)/$(domain)/."
|
2023-10-21 20:08:35 +00:00
|
|
|
create => "true",
|
|
|
|
perms => m("755");
|
|
|
|
|
2023-11-03 07:55:37 +00:00
|
|
|
"$(conf_dir)/$(domain)/robot.conf"
|
2023-10-21 20:08:35 +00:00
|
|
|
perms => m("644"),
|
|
|
|
copy_from => seed_cp("$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/sympa/robot.conf"),
|
|
|
|
handle => "sympa_robot_$(domain)_ready";
|
|
|
|
|
2023-11-03 07:55:37 +00:00
|
|
|
"$(conf_dir)/$(domain)/robot.conf"
|
2023-10-21 20:08:35 +00:00
|
|
|
create => "true",
|
|
|
|
perms => m("644"), #"sympa","sympa"),
|
|
|
|
edit_line => set_config_values("$(this.bundle).settings"),
|
|
|
|
handle => "sympa_robots_created",
|
|
|
|
classes => if_repaired("sympa_repaired"),
|
|
|
|
depends_on => { "sympa_pkgs_installed","sympa_robot_$(domain)_ready" };
|
|
|
|
|
|
|
|
reports:
|
|
|
|
# "INSTALL DOMAIN $(domain)";
|
|
|
|
# "WWSYMuRL:$(data[settings][wwsympa_url])";
|
|
|
|
# "OUT: $(settings)";
|
|
|
|
# "JO: $(jo)";
|
|
|
|
}
|
|
|
|
|
2023-11-03 07:55:37 +00:00
|
|
|
bundle agent install_sympa_domains(dl,conf_dir)
|
2023-10-21 20:08:35 +00:00
|
|
|
{
|
|
|
|
vars:
|
|
|
|
"idx" slist => getindices(@(dl));
|
|
|
|
methods:
|
2023-11-03 07:55:37 +00:00
|
|
|
"any" usebundle => install_sympa_domain("$(idx)",@(dl[$(idx)]),"$(conf_dir)");
|
2023-10-21 20:08:35 +00:00
|
|
|
|
|
|
|
reports:
|
|
|
|
}
|
|
|
|
|
2023-10-31 16:22:50 +00:00
|
|
|
bundle agent sympa_create_mailname(cfg)
|
|
|
|
{
|
|
|
|
files:
|
|
|
|
debian::
|
|
|
|
"/etc/mailname"
|
|
|
|
create => "true",
|
|
|
|
perms => m("644"),
|
|
|
|
content=>"$(cfg[settings][domain])";
|
|
|
|
|
|
|
|
}
|
2023-10-21 20:08:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bundle agent install_sympa(cfg)
|
|
|
|
{
|
2023-11-03 07:55:37 +00:00
|
|
|
classes:
|
|
|
|
"etc_changed" expression => isvariable("cfg[settings][etc]");
|
|
|
|
|
2023-10-21 20:08:35 +00:00
|
|
|
vars:
|
|
|
|
"domains_idx" slist => getindices(@(cfg[domains]));
|
2023-11-03 07:55:37 +00:00
|
|
|
|
|
|
|
etc_changed::
|
|
|
|
"cfg_dir" string => "$(cfg[settings][etc])";
|
|
|
|
|
|
|
|
!etc_changed::
|
|
|
|
"cfg_dir" string => "$(sympa.conf_dir)";
|
|
|
|
|
2023-10-21 20:08:35 +00:00
|
|
|
methods:
|
2023-10-31 16:22:50 +00:00
|
|
|
"any" usebundle => sympa_create_mailname(@(cfg));
|
2023-11-03 11:54:54 +00:00
|
|
|
#"any" usebundle => wmde_install_packages(@(sympa.pkgs),"sympa");
|
|
|
|
"any" usebundle => install_sympa_pkgs;
|
|
|
|
|
2023-10-21 20:08:35 +00:00
|
|
|
"any" usebundle => sympa_update_config(@(cfg));
|
|
|
|
"any" usebundle => sympa_init_db(@(cfg));
|
|
|
|
|
|
|
|
"any" usebundle => wmde_service("$(sympa.service_name)","sympa_kept","sympa_repaired"),
|
|
|
|
depends_on => {
|
|
|
|
"sympa_pkgs_installed",
|
2023-11-03 07:55:37 +00:00
|
|
|
"sympa_config_updated",
|
|
|
|
"sympa_robots_created"
|
2023-10-21 20:08:35 +00:00
|
|
|
};
|
|
|
|
"any" usebundle => wmde_service("$(sympa.wwservice_name)","sympa_kept","sympa_repaired"),
|
|
|
|
depends_on => {
|
|
|
|
"sympa_pkgs_installed",
|
|
|
|
"sympa_config_updated",
|
|
|
|
"sympa_robots_created"
|
|
|
|
};
|
|
|
|
|
2023-11-03 07:55:37 +00:00
|
|
|
"any" usebundle => install_sympa_domains(@(cfg[domains]),"$(cfg_dir)");
|
2023-10-21 20:08:35 +00:00
|
|
|
reports:
|
2023-11-03 07:55:37 +00:00
|
|
|
|
2023-10-21 20:08:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bundle agent install_sympa_src(cfg)
|
|
|
|
{
|
|
|
|
classes:
|
|
|
|
"run_backups" expression => isvariable("cfg[backup_dir]");
|
|
|
|
|
|
|
|
run_backups::
|
|
|
|
"sql_backup_exists" expression => fileexists("$(cfg[backup_dir])/sympa.sql");
|
|
|
|
|
|
|
|
methods:
|
|
|
|
"any" usebundle => mysql_table_exists(@(cfg),"user_table");
|
|
|
|
|
|
|
|
"run_backups&sql_backup_exists&(!mysql_sympa_user_table_exists)"::
|
|
|
|
"any" usebundle => restore_mysql_db(@(cfg),"$(cfg[backup_dir])/sympa.sql");
|
|
|
|
|
|
|
|
|
|
|
|
vars:
|
|
|
|
debian::
|
|
|
|
"pkgs" slist => {
|
|
|
|
"clang",
|
|
|
|
"gcc",
|
|
|
|
"make",
|
|
|
|
"mhonarc",
|
|
|
|
"libdbd-mysql-perl",
|
|
|
|
"spawn-fcgi",
|
|
|
|
"libdbd-mysql-perl",
|
|
|
|
"libdatetime-format-mail-perl",
|
|
|
|
"libmime-encwords-perl",
|
|
|
|
"libmime-lite-html-perl",
|
|
|
|
"cpanminus"
|
|
|
|
};
|
|
|
|
"cfg_file" string => "/etc/sympa/sympa.conf";
|
|
|
|
"log_file" string => "/var/log/sympa.log";
|
|
|
|
"syslog_cfg" string => "/etc/rsyslog.d/sympa.conf";
|
|
|
|
"syslog_service" string => "rsyslog";
|
|
|
|
freebsd::
|
|
|
|
"pkgs" slist => {};
|
|
|
|
"cfg_file" string => "/usr/local/etc/sympa/sympa.conf";
|
|
|
|
"log_file" string => "/var/log/sympa.log";
|
|
|
|
"syslog_cfg" string => "/etc/syslog.d/sympa.conf";
|
|
|
|
"syslog_service" string => "syslogd";
|
|
|
|
|
|
|
|
any::
|
|
|
|
"src_tgz" string => "sympa-$(cfg[version]).tar.gz";
|
|
|
|
"extract_dir" string => "$(sys.workdir)/data/agent/sympa";
|
|
|
|
"compile_dir" string => "$(extract_dir)/sympa-$(cfg[version])";
|
|
|
|
|
|
|
|
"configure_options" string => "--prefix $(sympa.install_dir)";
|
|
|
|
|
|
|
|
"sympa_pl_cmd" string => "$(sympa.install_dir)/bin/sympa.pl";
|
|
|
|
|
|
|
|
classes:
|
|
|
|
"compile_and_install" expression => not(fileexists("$(compile_dir)/installed.txt"));
|
|
|
|
|
|
|
|
commands:
|
|
|
|
'if grep -q sympa /etc/group ; then echo "+sympa_group_exists"; else echo "-sympa_group_exists" ; fi'
|
|
|
|
module => "true",
|
|
|
|
inform => "false",
|
|
|
|
contain => wmde_cmd_useshell;
|
|
|
|
|
|
|
|
|
|
|
|
debian&(!sympa_group_exists)::
|
|
|
|
"/usr/sbin/groupadd"
|
|
|
|
args => "sympa",
|
|
|
|
handle => "sympa_group_created";
|
|
|
|
debian&sympa_group_exists::
|
|
|
|
"/usr/bin/true"
|
|
|
|
inform => "false",
|
|
|
|
handle => "sympa_group_created";
|
|
|
|
|
|
|
|
methods:
|
|
|
|
"any" usebundle => wmde_install_packages(@(pkgs),"sympabuild");
|
|
|
|
|
|
|
|
files:
|
|
|
|
"$(extract_dir)/."
|
|
|
|
create => "true",
|
|
|
|
handle => "sympa_extract_dir_created";
|
|
|
|
|
|
|
|
users:
|
|
|
|
"sympa"
|
|
|
|
policy => "present",
|
|
|
|
description => "Sympa System",
|
|
|
|
home_dir => "$(sympa.install_dir)",
|
|
|
|
group_primary => "sympa",
|
|
|
|
depends_on => {"sympa_group_created"},
|
|
|
|
shell => "/bin/bash";
|
|
|
|
|
|
|
|
methods:
|
|
|
|
"any" usebundle => download_and_untar (
|
|
|
|
"sympa",
|
|
|
|
"$(def.hub_public_dir)/$(src_tgz)",
|
|
|
|
"$(sys.workdir)/data/public/$(src_tgz)",
|
|
|
|
"$(extract_dir)",
|
|
|
|
"$(compile_dir)/configure"
|
|
|
|
),
|
|
|
|
depends_on => {"sympabuild_pkgs_installed","sympa_extract_dir_created"},
|
|
|
|
handle => "sympa_downloaded";
|
|
|
|
|
|
|
|
commands:
|
|
|
|
compile_and_install::
|
|
|
|
"cd $(compile_dir) && ./configure $(configure_options) && make && make install && cpanm --installdeps --with-recommends -n . && touch installed.txt"
|
|
|
|
contain => wmde_cmd_useshell,
|
|
|
|
depends_on => {"sympa_downloaded"},
|
|
|
|
handle => "sympa_installed";
|
|
|
|
|
|
|
|
!compile_and_install::
|
|
|
|
"/usr/bin/true"
|
|
|
|
inform => "false",
|
|
|
|
handle => "sympa_installed";
|
|
|
|
|
|
|
|
|
|
|
|
vars:
|
|
|
|
"settings[domain]" string => "$(cfg[domain])";
|
|
|
|
"settings[listmaster]" string => "$(cfg[listmaster])";
|
|
|
|
"settings[db_type]" string => "$(cfg[db_type])";
|
|
|
|
"settings[db_host]" string => "$(cfg[db_host])";
|
|
|
|
"settings[db_user]" string => "$(cfg[db_user])";
|
|
|
|
"settings[db_passwd]" string => "$(cfg[db_pass])";
|
|
|
|
"settings[wwsympa_url]" string => "$(cfg[wwsympa_url])";
|
|
|
|
"settings[listmaster]" string => "$(cfg[listmaster])";
|
|
|
|
"settings[sendmail_aliases]" string=> "$(cfg[sendmail_aliases])";
|
|
|
|
"settings[aliases_program]" string=> "$(cfg[aliases_program])";
|
|
|
|
|
|
|
|
|
|
|
|
files:
|
|
|
|
"$(cfg_file)"
|
|
|
|
edit_line => set_config_values("$(this.bundle).settings"),
|
|
|
|
handle => "sympa_config_edited_old",
|
|
|
|
classes => if_repaired("sympa_config_changed"),
|
|
|
|
depends_on => { "sympa_installed" };
|
|
|
|
|
|
|
|
commands:
|
|
|
|
"sympa_config_changed|(!mysql_sympa_user_table_exists)"::
|
|
|
|
"$(sympa.sympa_pl_cmd)"
|
|
|
|
args => "--health_check",
|
|
|
|
depends_on => {"sympa_config_edited_old"};
|
|
|
|
|
|
|
|
|
|
|
|
# Sympa Logs
|
|
|
|
files:
|
|
|
|
"$(log_file)"
|
|
|
|
create=>"true",
|
|
|
|
perms=>m("644");
|
|
|
|
|
|
|
|
"$(syslog_cfg)"
|
|
|
|
create=>"true",
|
|
|
|
content=>"local1.* -/var/log/sympa.log
|
|
|
|
",
|
|
|
|
handle => "sympa_syslog_cfg_ready",
|
|
|
|
classes => if_repaired("sympa_syslog_cfg_repaired");
|
|
|
|
|
|
|
|
services:
|
|
|
|
sympa_syslog_cfg_repaired::
|
|
|
|
"$(syslog_service)"
|
|
|
|
depends_on => {"sympa_syslog_cfg_ready"},
|
|
|
|
service_policy=>"restart";
|
|
|
|
|
|
|
|
|
|
|
|
# Configure Backup stuff
|
|
|
|
files:
|
|
|
|
run_backups::
|
|
|
|
"$(cfg[backup_dir])/."
|
|
|
|
create => "true";
|
|
|
|
methods:
|
|
|
|
run_backups::
|
|
|
|
"any" usebundle => create_mysql_backup_cron_job(@(cfg),"$(cfg[backup_dir])/sympa.sql","user_table","true");
|
|
|
|
!run_backups::
|
|
|
|
"any" usebundle => create_mysql_backup_cron_job(@(cfg),"$(cfg[backup_dir])/sympa.sql","user_table","false");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reports:
|
2023-10-31 16:22:50 +00:00
|
|
|
run_backup::
|
|
|
|
"SYMPA IS RUN BACKUP";
|
|
|
|
|
|
|
|
!run_backup::
|
|
|
|
"SYMPA DOES NOT RUN BACKUP";
|
2023-10-21 20:08:35 +00:00
|
|
|
|
|
|
|
}
|
2023-11-03 11:54:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
bundle agent install_sympa_pkgs
|
|
|
|
{
|
|
|
|
methods:
|
|
|
|
"any" usebundle => wmde_install_packages(@(sympa.pkgs),"sympa");
|
|
|
|
|
|
|
|
}
|