Compare commits

..

3 Commits

Author SHA1 Message Date
Tobias Herre 9d8d6cd332 Removed debug prints 2024-04-04 11:30:30 +02:00
Tobias Herre 5184e10af9 Removed some apache stuff 2024-02-21 15:55:00 +01:00
Tobias Herre a48feb88b2 Works on Debian (>=12), raw parameter added 2024-02-21 10:36:46 +01:00
2 changed files with 43 additions and 5 deletions

View File

@ -13,6 +13,19 @@ centos::
"cfg_dir" string => "/etc/nginx"; "cfg_dir" string => "/etc/nginx";
"vhost_cfg_dir" string => "$(cfg_dir)/conf.d"; "vhost_cfg_dir" string => "$(cfg_dir)/conf.d";
"service_name" string => "nginx"; "service_name" string => "nginx";
debian::
"www_dir" string => "/var/www",unless => isvariable( $(this.promiser) ) ;
"www_user" string => "www-data";
"www_group" string => "www-data";
"cfg_dir" string => "/etc/nginx";
"vhost_cfg_dir" string => "$(cfg_dir)/conf.d";
"service_name" string => "nginx";
any::
"service_deps" slist => {
"nginx_pkgs_installed",
"nginx_www_dir_created",
};
any:: any::
@ -46,13 +59,20 @@ files:
create => "true", create => "true",
handle => "nginx_work_dir_created"; handle => "nginx_work_dir_created";
methods:
"any" usebundle => wmde_enable_service("nginx");
"any" usebundle => wmde_service("$(nginx.service_name)","nginx_kept","nginx_repaired"),
depends_on => @(nginx.service_deps) ;
commands: commands:
"/bin/sh" "/bin/sh"
args => "$(sys.workdir)/inputs/$(def.wmde_libdir)/scripts/del-files-not-in-list.sh $(nginx.vhost_cfg_dir) $(sys.workdir)/data/agent/nginx/domains.txt && echo dummy.conf > $(sys.workdir)/data/agent/nginx/domains.txt", args => "$(sys.workdir)/inputs/$(def.wmde_libdir)/scripts/del-files-not-in-list.sh $(nginx.vhost_cfg_dir) $(sys.workdir)/data/agent/nginx/domains.txt && echo dummy.conf > $(sys.workdir)/data/agent/nginx/domains.txt",
inform => "false", inform => "false",
handle => "nginx_vhost_dir_cleaned", handle => "nginx_vhost_dir_cleaned",
# depends_on => {"apache_dummy_conf_created"}, # depends_on => {"nginx_dummy_conf_created"},
contain => wmde_cmd_useshell; contain => wmde_cmd_useshell;
@ -72,7 +92,7 @@ classes:
"do_logrotate" expression => $(site[logrotate]); "do_logrotate" expression => $(site[logrotate]);
vars: vars:
# "email":$(apache.admin_email), # "email":$(nginx.admin_email),
"site_defaults" data => ' "site_defaults" data => '
{ {
@ -174,9 +194,9 @@ commands:
reports: reports:
"SITE: $(site[domain]): $(site[logrotate])"; # "SITE: $(site[domain]): $(site[logrotate])";
"SF: @(site)"; # "SF: @(site)";
"DF $(domain_file)"; # "DF $(domain_file)";
delete:: delete::
"DELETE TRUE"; "DELETE TRUE";
@ -191,3 +211,19 @@ reports:
} }
bundle agent nginx_vhosts(sites)
{
vars:
"idx" slist => getindices(@(sites));
methods:
"any" usebundle => nginx_vhost(@(sites[$(idx)]));
reports:
}

View File

@ -13,6 +13,7 @@ server {
alias {{vars.nginx.default_html_dir}}/.well-known/acme-challenge/; alias {{vars.nginx.default_html_dir}}/.well-known/acme-challenge/;
try_files $uri $uri/ =404; try_files $uri $uri/ =404;
} }
{{{vars.nginx_vhost.site.raw}}}
} }
{{/vars.nginx_vhost.site.ssl}} {{/vars.nginx_vhost.site.ssl}}
@ -51,6 +52,7 @@ server {
# ssl_dhparam /etc/nginx/dhparam.pem; # ssl_dhparam /etc/nginx/dhparam.pem;
root {{vars.nginx_vhost.site.doc_root}}; root {{vars.nginx_vhost.site.doc_root}};
{{{vars.nginx_vhost.site.raw}}}
} }