Compare commits
No commits in common. "ba31a7cfa3b0eeba2f93586284e6f1310f6bf27d" and "a68e6c7aed96b71c0f1c3773398e1187bda75dbc" have entirely different histories.
ba31a7cfa3
...
a68e6c7aed
20
apache.cf
20
apache.cf
|
@ -202,15 +202,14 @@ methods:
|
||||||
"any" usebundle => install_apache_php,
|
"any" usebundle => install_apache_php,
|
||||||
depends_on => { "apache_pkgs_installed" };
|
depends_on => { "apache_pkgs_installed" };
|
||||||
commands:
|
commands:
|
||||||
# freebsd::
|
freebsd::
|
||||||
# "/usr/sbin/sysrc"
|
"/usr/sbin/sysrc"
|
||||||
# handle => "apache_editrc",
|
handle => "apache_editrc",
|
||||||
# args => "apache24_enable=yes",
|
args => "apache24_enable=yes",
|
||||||
# inform=>"false";
|
inform=>"false";
|
||||||
# debian|centos::
|
debian|centos::
|
||||||
# any::
|
"/bin/true" handle => "apache_editrc",
|
||||||
# "/bin/true" handle => "apache_editrc",
|
inform => "false";
|
||||||
# inform => "false";
|
|
||||||
|
|
||||||
files:
|
files:
|
||||||
"$(apache.log_dir)/."
|
"$(apache.log_dir)/."
|
||||||
|
@ -246,9 +245,8 @@ files:
|
||||||
classes => if_repaired(apache_changed);
|
classes => if_repaired(apache_changed);
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# apache_editrs depends
|
|
||||||
"$(apache.service_name)"
|
"$(apache.service_name)"
|
||||||
depends_on => {"apache_vhost_dir_created","apache_www_dir_created","apache_main_cfg_crreated"},
|
depends_on => {"apache_editrc","apache_vhost_dir_created","apache_www_dir_created","apache_main_cfg_crreated"},
|
||||||
service_policy => "start",
|
service_policy => "start",
|
||||||
handle => "apache_running";
|
handle => "apache_running";
|
||||||
|
|
||||||
|
|
7
lib.cf
7
lib.cf
|
@ -30,13 +30,6 @@ packages:
|
||||||
package_module => apt_get,
|
package_module => apt_get,
|
||||||
handle => "$(name)_pkgs_installed",
|
handle => "$(name)_pkgs_installed",
|
||||||
classes => results("namespace","$(name)");
|
classes => results("namespace","$(name)");
|
||||||
fedora|centos::
|
|
||||||
"$(pkgs)"
|
|
||||||
policy => "present",
|
|
||||||
package_module => yum,
|
|
||||||
handle => "$(name)_pkgs_installed",
|
|
||||||
classes => results("namespace","$(name)");
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
105
mysql.cf
105
mysql.cf
|
@ -14,31 +14,20 @@ vars:
|
||||||
"cfg" data => mergedata(@(default_cfg),@(cfg_param));
|
"cfg" data => mergedata(@(default_cfg),@(cfg_param));
|
||||||
|
|
||||||
freebsd::
|
freebsd::
|
||||||
# "server_pkgs" slist => {"mariadb106-server"};
|
# "pkg" string => "mariadb106-server";
|
||||||
# "client_pkgs" slist => {"mariadb106-client"};
|
"pkg" slist => {"mysql80-server"};
|
||||||
"server_pkgs" slist => {"mysql80-server"};
|
|
||||||
"client_pkgs" slist => {"mysql80-client"};
|
"client_pkgs" slist => {"mysql80-client"};
|
||||||
"type" string => "mysql8";
|
|
||||||
"service_name" string => "mysql-server";
|
"service_name" string => "mysql-server";
|
||||||
"cfg_dir" string => "/usr/local/etc/mysql";
|
"cfg_dir" string => "/usr/local/etc/mysql";
|
||||||
"cfg_file" string => "/usr/local/etc/mysql/my.cnf";
|
"cfg_file" string => "/usr/local/etc/mysql/my.cnf";
|
||||||
"bin_dir" string => "/usr/local/bin";
|
"bin_dir" string => "/usr/local/bin";
|
||||||
debian::
|
debian::
|
||||||
"server_pkgs" slist => {"mariadb-server"};
|
"pkg" slist => {"mariadb-server"};
|
||||||
"client_pkgs" slist => {"mariadb-client"};
|
"client_pkgs" slist => {"mariadb-client"};
|
||||||
"type" string => "mariadb";
|
|
||||||
"service_name" string => "mysql";
|
"service_name" string => "mysql";
|
||||||
"cfg_dir" string => "/etc/mysql";
|
"cfg_dir" string => "/etc/mysql";
|
||||||
"cfg_file" string => "/etc/mysql/my.cnf";
|
"cfg_file" string => "/etc/mysql/my.cnf";
|
||||||
"bin_dir" string => "/usr/bin";
|
"bin_dir" string => "/usr/bin";
|
||||||
fedora::
|
|
||||||
"server_pkgs" slist => {"mariadb-server"};
|
|
||||||
"client_pkgs" slist => {"mariadb-client"};
|
|
||||||
"type" string => "mariadb";
|
|
||||||
"service_name" string => "mariadb";
|
|
||||||
"cfg_dir" string => "/etc/mysql";
|
|
||||||
"cfg_file" string => "/etc/my.cnf";
|
|
||||||
"bin_dir" string => "/usr/bin"; any::
|
|
||||||
any::
|
any::
|
||||||
"mysql_cmd" string => "$(bin_dir)/mysql";
|
"mysql_cmd" string => "$(bin_dir)/mysql";
|
||||||
"mysqldump_cmd" string => "$(bin_dir)/mysqldump";
|
"mysqldump_cmd" string => "$(bin_dir)/mysqldump";
|
||||||
|
@ -67,6 +56,10 @@ files:
|
||||||
classes => if_repaired("mysql_repaired");
|
classes => if_repaired("mysql_repaired");
|
||||||
|
|
||||||
|
|
||||||
|
methods:
|
||||||
|
"any" usebundle => wmde_install_packages(@(mysql.pkg),"mysql"),
|
||||||
|
depends_on => { "mysql_cfg_created"};
|
||||||
|
|
||||||
services:
|
services:
|
||||||
"$(service_name)"
|
"$(service_name)"
|
||||||
depends_on => {"mysql_pkgs_installed"},
|
depends_on => {"mysql_pkgs_installed"},
|
||||||
|
@ -81,83 +74,7 @@ services:
|
||||||
reports:
|
reports:
|
||||||
}
|
}
|
||||||
|
|
||||||
bundle agent install_mysql_server(cfg)
|
|
||||||
{
|
|
||||||
vars:
|
|
||||||
|
|
||||||
"mysqld_idx" slist => getindices(@(cfg[settings][mysqld]));
|
|
||||||
"settings[mysqld][$(mysqld_idx)]" string => "$(cfg[settings][mysqld][$(mysqld_idx)])";
|
|
||||||
|
|
||||||
|
|
||||||
"j" string => storejson(@(cfg));
|
|
||||||
methods:
|
|
||||||
"any" usebundle => wmde_install_packages(@(mysql.server_pkgs),"mysql_server");
|
|
||||||
|
|
||||||
files:
|
|
||||||
"$(mysql.cfg_file)"
|
|
||||||
copy_from => seed_cp("$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/my.cnf.mustache"),
|
|
||||||
handle => "myslq_server_cfg_created",
|
|
||||||
depends_on => {"mysql_server_pkgs_installed"};
|
|
||||||
|
|
||||||
|
|
||||||
"$(mysql.cfg_file)"
|
|
||||||
create => "true",
|
|
||||||
perms => m("644"),
|
|
||||||
edit_line => set_variable_values_inix("$(this.bundle).settings","mysqld"),
|
|
||||||
depends_on => {"myslq_server_cfg_created"},
|
|
||||||
handle => "myslq_server_cfg_edited",
|
|
||||||
classes => if_repaired("mysql_server_repaired");
|
|
||||||
|
|
||||||
methods:
|
|
||||||
"any" usebundle => wmde_service("$(mysql.service_name)","mysql_server_kept","mysql_server_repaired"),
|
|
||||||
depends_on => {"myslq_server_cfg_edited"};
|
|
||||||
|
|
||||||
reports:
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bundle edit_line set_variable_values_inix(tab, sectionName)
|
|
||||||
{
|
|
||||||
vars:
|
|
||||||
"index" slist => getindices("$(tab)[$(sectionName)]");
|
|
||||||
|
|
||||||
# Be careful if the index string contains funny chars
|
|
||||||
"cindex[$(index)]" string => canonify("$(index)");
|
|
||||||
|
|
||||||
classes:
|
|
||||||
"edit_$(cindex[$(index)])" not => strcmp("$($(tab)[$(sectionName)][$(index)])","dontchange"),
|
|
||||||
comment => "Create conditions to make changes";
|
|
||||||
|
|
||||||
field_edits:
|
|
||||||
|
|
||||||
# If the line is there, but commented out, first uncomment it
|
|
||||||
# "#+\s*$(index)\s*=.*"
|
|
||||||
# select_region => INI_section(escape("$(sectionName)")),
|
|
||||||
# edit_field => col("\s*=\s*","1","$(index)","set"),
|
|
||||||
# if => "edit_$(cindex[$(index)])";
|
|
||||||
|
|
||||||
# match a line starting like the key something
|
|
||||||
"\s*$(index)\s*=.*"
|
|
||||||
edit_field => col("\s*=\s*","2","$($(tab)[$(sectionName)][$(index)])","set"),
|
|
||||||
select_region => INI_section(escape("$(sectionName)")),
|
|
||||||
classes => results("bundle", "set_variable_values_ini_not_$(cindex[$(index)])"),
|
|
||||||
if => "edit_$(cindex[$(index)])";
|
|
||||||
|
|
||||||
delete_lines:
|
|
||||||
"!include.*";
|
|
||||||
|
|
||||||
insert_lines:
|
|
||||||
"[$(sectionName)]"
|
|
||||||
location => start,
|
|
||||||
comment => "Insert lines";
|
|
||||||
|
|
||||||
"$(index)=$($(tab)[$(sectionName)][$(index)])"
|
|
||||||
select_region => INI_section(escape("$(sectionName)")),
|
|
||||||
if => "!(set_variable_values_ini_not_$(cindex[$(index)])_kept|set_variable_values_ini_not_$(cindex[$(index)])_repaired).edit_$(cindex[$(index)])";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bundle agent install_mysql_client
|
bundle agent install_mysql_client
|
||||||
{
|
{
|
||||||
|
@ -261,22 +178,16 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
|
|
||||||
bundle agent create_mysql_db(cfg)
|
bundle agent create_mysql_db(cfg)
|
||||||
{
|
{
|
||||||
classes:
|
|
||||||
"type_$(mysql.type)" ;
|
|
||||||
vars:
|
vars:
|
||||||
"db_name" string => "$(cfg[db_name])";
|
"db_name" string => "$(cfg[db_name])";
|
||||||
"db_user" string => "$(cfg[db_user])";
|
"db_user" string => "$(cfg[db_user])";
|
||||||
"host" string => "$(cfg[db_user_host])";
|
"host" string => "$(cfg[db_user_host])";
|
||||||
"db_pass" string => "$(cfg[db_pass])";
|
"db_pass" string => "$(cfg[db_pass])";
|
||||||
|
|
||||||
type_mariadb::
|
|
||||||
"args" string => "-e \"CREATE DATABASE IF NOT EXISTS $(db_name); GRANT ALL PRIVILEGES ON $(db_name).* TO '$(db_user)'@'$(host)' IDENTIFIED BY '$(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)'; \" ";
|
||||||
|
|
||||||
type_mysql8::
|
|
||||||
"args" string => "-e \"CREATE DATABASE IF NOT EXISTS $(db_name); CREATE USER IF NOT EXISTS '$(db_user)'@'$(host)'; ALTER USER '$(db_user)'@'$(host)' IDENTIFIED BY '$(db_pass)'; GRANT ALL PRIVILEGES ON $(db_name).* TO '$(db_user)'@'$(host)';\" ";
|
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
debian::
|
||||||
"$(mysql.mysql_cmd)"
|
"$(mysql.mysql_cmd)"
|
||||||
args => "$(args)",
|
args => "$(args)",
|
||||||
inform => "false";
|
inform => "false";
|
||||||
|
|
5
php.cf
5
php.cf
|
@ -28,11 +28,6 @@ vars:
|
||||||
"php$(bsdvs)-pdo_mysql",
|
"php$(bsdvs)-pdo_mysql",
|
||||||
"php$(bsdvs)-pdo",
|
"php$(bsdvs)-pdo",
|
||||||
"php$(bsdvs)-filter",
|
"php$(bsdvs)-filter",
|
||||||
"php$(bsdvs)-mbstring",
|
|
||||||
"php$(bsdvs)-dom",
|
|
||||||
"php$(bsdvs)-xml",
|
|
||||||
"php$(bsdvs)-ctype",
|
|
||||||
"php$(bsdvs)-intl",
|
|
||||||
};
|
};
|
||||||
# "php$(bsdvs)-json",
|
# "php$(bsdvs)-json",
|
||||||
|
|
||||||
|
|
|
@ -58,9 +58,8 @@ methods:
|
||||||
commands:
|
commands:
|
||||||
roundcube_untar::
|
roundcube_untar::
|
||||||
"/usr/bin/tar"
|
"/usr/bin/tar"
|
||||||
args => "xzf $(dlfile) -C $(cfg[install_dir]) && chown -R $(cfg[www_user]):$(cfg[www_group]) $(cfg[install_dir])",
|
args => "xzvf $(dlfile) -C $(cfg[install_dir])",
|
||||||
depends_on => {"roundcube_tgz_copied"},
|
depends_on => {"roundcube_tgz_copied"},
|
||||||
contain => wmde_cmd_useshell,
|
|
||||||
handle => "roundcube_untarred";
|
handle => "roundcube_untarred";
|
||||||
!roundcube_untar::
|
!roundcube_untar::
|
||||||
"/usr/bin/true"
|
"/usr/bin/true"
|
||||||
|
|
|
@ -1,9 +1,22 @@
|
||||||
#
|
#
|
||||||
# Created by CFEngine
|
# Managed by CFEngine
|
||||||
#
|
#
|
||||||
|
|
||||||
[client-server]
|
[client-server]
|
||||||
|
port = {{vars.cfg.mysql.port}}
|
||||||
|
socket = /run/mysqld/mysqld.sock
|
||||||
|
|
||||||
|
#[mysql]
|
||||||
|
#prompt = \u@\h [\d]>\_
|
||||||
|
#no_auto_rehash
|
||||||
|
|
||||||
[mysqld]
|
[mysqld]
|
||||||
|
#log-error =/var/log/mysql/mysqld.log
|
||||||
|
user = {{vars.mysql.cfg.user}}
|
||||||
|
port = {{vars.mysql.cfg.port}}
|
||||||
|
bind-address = {{vars.mysql.cfg.bind_address}}
|
||||||
|
|
||||||
|
lower_case_table_names = 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
4
vim.cf
4
vim.cf
|
@ -13,7 +13,7 @@ vars:
|
||||||
debian::
|
debian::
|
||||||
"vimrc" string => "/etc/vim/vimrc";
|
"vimrc" string => "/etc/vim/vimrc";
|
||||||
"pkg" string => "vim";
|
"pkg" string => "vim";
|
||||||
centos|fedora::
|
centos::
|
||||||
"vimrc" string => "/etc/vim/vimrc";
|
"vimrc" string => "/etc/vim/vimrc";
|
||||||
"pkg" string => "vim-enhanced";
|
"pkg" string => "vim-enhanced";
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ packages:
|
||||||
"$(pkg)"
|
"$(pkg)"
|
||||||
policy => "present",
|
policy => "present",
|
||||||
package_module => apt_get;
|
package_module => apt_get;
|
||||||
fedora|centos::
|
centos::
|
||||||
"$(pkg)"
|
"$(pkg)"
|
||||||
policy => "present",
|
policy => "present",
|
||||||
package_module => yum;
|
package_module => yum;
|
||||||
|
|
Loading…
Reference in New Issue