Compare commits
6 Commits
35711c2594
...
2b14b23ff1
Author | SHA1 | Date |
---|---|---|
Tobias Herre | 2b14b23ff1 | |
Tobias Herre | 4da4e6e5e4 | |
Tobias Herre | c826f0a139 | |
Tobias Herre | c7d6bc710a | |
Tobias Herre | ff7343babe | |
Tobias Herre | 44a5ec4cd0 |
|
@ -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])";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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
10
lib.cf
|
@ -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)";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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:
|
||||
}
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue