Compare commits

...

6 Commits

Author SHA1 Message Date
Tobias Herre 2b14b23ff1 Removed reports 2023-10-09 12:16:36 +02:00
Tobias Herre 4da4e6e5e4 Initial commit 2023-10-09 12:16:05 +02:00
Tobias Herre c826f0a139 Uses doc_root parameter now 2023-10-08 00:36:00 +02:00
Tobias Herre c7d6bc710a Added doc_root parameter 2023-10-08 00:35:18 +02:00
Tobias Herre ff7343babe Initial commit 2023-10-06 23:05:35 +02:00
Tobias Herre 44a5ec4cd0 uses classes result 2023-10-06 19:42:23 +02:00
5 changed files with 101 additions and 10 deletions

View File

@ -256,7 +256,8 @@ vars:
{
"aliases":[],
"ssl_cert":"certbot",
"email":"$(apache.admin_email)"
"email":"$(apache.admin_email)",
"doc_root":"$(apache.www_dir)/$(site_param[domain])"
}
';
@ -329,6 +330,7 @@ reports:
# "NOT USE_SSL";
# "RAW: $(site[raw])";
# "APACHE DOCROOT $(site[doc_root])";
}

20
git.cf Normal file
View File

@ -0,0 +1,20 @@
#
#
#
bundle agent git
{
vars:
freebsd::
"pkgs" slist => { "git" };
"exe" string => "/usr/local/bin/git";
debian::
"pkgs" slist => { "git" };
"exe" string => "/usr/bin/git";
}
bundle agent install_git
{
methods:
"any" usebundle => wmde_install_packages(@(git.pkgs),"git");
}

10
lib.cf
View File

@ -22,14 +22,15 @@ packages:
"$(pkgs)"
policy => "present",
package_module => pkg,
classes => if_repaired("$(name)_repaired"),
classes => if_ok("$(name)_ok");
handle => "$(name)_pkgs_installed",
classes => results("namespace","$(name)");
debian::
"$(pkgs)"
policy => "present",
package_module => apt_get,
classes => if_repaired("$(name)_repaired"),
classes => if_ok("$(name)_ok");
handle => "$(name)_pkgs_installed",
classes => results("namespace","$(name)");
}
body perms wmde_perms(user,group,mode)
@ -108,7 +109,6 @@ services:
"$(service_name)"
service_policy => "restart";
reports:
"SERVICE $(service_name) - Start on: $(start_cond) Restart if: $(restart_cond)";
}

69
mysql.cf Normal file
View File

@ -0,0 +1,69 @@
#
#
#
bundle agent mysql
{
vars:
"bind_address" string => "127.0.0.1";
"user" string => "mysql";
"port" string => "3306";
freebsd::
# "pkg" string => "mariadb106-server";
"pkg" string => "mysql80-server";
"service_name" string => "mysql-server";
"cfg_file" string => "/usr/local/etc/mysql/my.cnf";
"mysql_cmd" string => "/usr/local/bin/mysql";
debian::
"pkg" string => "mariadb-server";
"service_name" string => "mysql";
"cfg_file" string => "/etc/mysql/my.cnf";
"mysql_cmd" string => "/usr/bin/mysql";
files:
"$(cfg_file)"
create => "true",
perms => m("644"),
edit_template => "$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/my.cnf.mustache",
template_method => "mustache",
handle => "mysql_cfg_created",
depends_on => {"mysql_pkgs_installed"},
classes => if_repaired("mysql_repaired");
methods:
"any" usebundle => wmde_install_packages("$(mysql.pkg)","mysql");
services:
"$(service_name)"
depends_on => {"mysql_pkgs_installed"},
service_policy => "start",
handle => "mysql_running";
mysql_repaired::
"$(service_name)"
service_policy => "restart",
depends_on => {"mysql_running","mysql_cfg_created"};
}
bundle agent create_mysql_db(cfg)
{
vars:
"db_name" string => "$(cfg[db_name])";
"db_user" string => "$(cfg[db_user])";
"host" string => "$(cfg[db_user_host])";
"db_pass" string => "$(cfg[db_pass])";
"args" string => "-e \"CREATE DATABASE IF NOT EXISTS $(db_name); GRANT ALL PRIVILEGES ON $(db_name).* TO '$(db_user)'@'$(host)' IDENTIFIED BY '$(db_pass)'; \" ";
commands:
debian::
"$(mysql.mysql_cmd)"
args => "$(args)",
inform => "false";
reports:
}

View File

@ -1,7 +1,7 @@
#
# Managed by CFEengine
#
<Directory {{vars.apache.www_dir}}/{{vars.apache_vhost.site.domain}}>
<Directory {{vars.apache_vhost.site.doc_root}}>
AllowOverride all
Options Indexes FollowSymLinks
Require all granted
@ -17,7 +17,7 @@
RewriteEngine On
Alias /.well-known/acme-challenge/ "{{vars.apache.default_html_dir}}/.well-known/acme-challenge/"
RewriteRule "^/.well-known/acme-challenge/" - [L]
DocumentRoot "{{vars.apache.www_dir}}/{{vars.apache_vhost.site.domain}}"
DocumentRoot "{{vars.apache_vhost.site.doc_root}}"
ServerAlias {{#vars.apache_vhost.site.aliases}}{{.}} {{/vars.apache_vhost.site.aliases}}
ErrorLog "{{vars.apache.log_dir}}/{{vars.apache_vhost.site.domain}}-error.log"
CustomLog "{{vars.apache.log_dir}}/{{vars.apache_vhost.site.domain}}-access.log" combined
@ -32,12 +32,12 @@
RewriteEngine On
Alias /.well-known/acme-challenge/ "{{vars.apache.default_html_dir}}/.well-known/acme-challenge/"
RewriteRule "^/.well-known/acme-challenge/" - [L]
DocumentRoot "{{vars.apache.www_dir}}/{{vars.apache_vhost.site.domain}}"
DocumentRoot "{{vars.apache_vhost.site.doc_root}}"
Redirect permanent / https://{{vars.apache_vhost.site.domain}}/
</VirtualHost>
<VirtualHost *:443>
ServerAdmin {{vars.apache_vhost.site.email}}
DocumentRoot "{{vars.apache.www_dir}}/{{vars.apache_vhost.site.domain}}"
DocumentRoot "{{vars.apache_vhost.site.doc_root}}"
ServerName {{vars.apache_vhost.site.domain}}
ServerAlias {{#vars.apache_vhost.site.aliases}}{{.}} {{/vars.apache_vhost.site.aliases}}
ErrorLog "{{vars.apache.log_dir}}/{{vars.apache_vhost.site.domain}}-error.log"