Compare commits
8 Commits
a68e6c7aed
...
ba31a7cfa3
Author | SHA1 | Date |
---|---|---|
Tube | ba31a7cfa3 | |
Tube | d78d7189d6 | |
Tube | ff692df2ee | |
Tube | 17ca7a5299 | |
Tube | 9285751709 | |
Tube | cdcc0bdcd5 | |
Tube | 176a9cf980 | |
Tube | 0c5024867d |
20
apache.cf
20
apache.cf
|
@ -202,14 +202,15 @@ methods:
|
|||
"any" usebundle => install_apache_php,
|
||||
depends_on => { "apache_pkgs_installed" };
|
||||
commands:
|
||||
freebsd::
|
||||
"/usr/sbin/sysrc"
|
||||
handle => "apache_editrc",
|
||||
args => "apache24_enable=yes",
|
||||
inform=>"false";
|
||||
debian|centos::
|
||||
"/bin/true" handle => "apache_editrc",
|
||||
inform => "false";
|
||||
# freebsd::
|
||||
# "/usr/sbin/sysrc"
|
||||
# handle => "apache_editrc",
|
||||
# args => "apache24_enable=yes",
|
||||
# inform=>"false";
|
||||
# debian|centos::
|
||||
# any::
|
||||
# "/bin/true" handle => "apache_editrc",
|
||||
# inform => "false";
|
||||
|
||||
files:
|
||||
"$(apache.log_dir)/."
|
||||
|
@ -245,8 +246,9 @@ files:
|
|||
classes => if_repaired(apache_changed);
|
||||
|
||||
services:
|
||||
# apache_editrs depends
|
||||
"$(apache.service_name)"
|
||||
depends_on => {"apache_editrc","apache_vhost_dir_created","apache_www_dir_created","apache_main_cfg_crreated"},
|
||||
depends_on => {"apache_vhost_dir_created","apache_www_dir_created","apache_main_cfg_crreated"},
|
||||
service_policy => "start",
|
||||
handle => "apache_running";
|
||||
|
||||
|
|
7
lib.cf
7
lib.cf
|
@ -30,6 +30,13 @@ packages:
|
|||
package_module => apt_get,
|
||||
handle => "$(name)_pkgs_installed",
|
||||
classes => results("namespace","$(name)");
|
||||
fedora|centos::
|
||||
"$(pkgs)"
|
||||
policy => "present",
|
||||
package_module => yum,
|
||||
handle => "$(name)_pkgs_installed",
|
||||
classes => results("namespace","$(name)");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
111
mysql.cf
111
mysql.cf
|
@ -14,20 +14,31 @@ vars:
|
|||
"cfg" data => mergedata(@(default_cfg),@(cfg_param));
|
||||
|
||||
freebsd::
|
||||
# "pkg" string => "mariadb106-server";
|
||||
"pkg" slist => {"mysql80-server"};
|
||||
# "server_pkgs" slist => {"mariadb106-server"};
|
||||
# "client_pkgs" slist => {"mariadb106-client"};
|
||||
"server_pkgs" slist => {"mysql80-server"};
|
||||
"client_pkgs" slist => {"mysql80-client"};
|
||||
"type" string => "mysql8";
|
||||
"service_name" string => "mysql-server";
|
||||
"cfg_dir" string => "/usr/local/etc/mysql";
|
||||
"cfg_file" string => "/usr/local/etc/mysql/my.cnf";
|
||||
"bin_dir" string => "/usr/local/bin";
|
||||
debian::
|
||||
"pkg" slist => {"mariadb-server"};
|
||||
"server_pkgs" slist => {"mariadb-server"};
|
||||
"client_pkgs" slist => {"mariadb-client"};
|
||||
"type" string => "mariadb";
|
||||
"service_name" string => "mysql";
|
||||
"cfg_dir" string => "/etc/mysql";
|
||||
"cfg_file" string => "/etc/mysql/my.cnf";
|
||||
"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::
|
||||
"mysql_cmd" string => "$(bin_dir)/mysql";
|
||||
"mysqldump_cmd" string => "$(bin_dir)/mysqldump";
|
||||
|
@ -56,10 +67,6 @@ files:
|
|||
classes => if_repaired("mysql_repaired");
|
||||
|
||||
|
||||
methods:
|
||||
"any" usebundle => wmde_install_packages(@(mysql.pkg),"mysql"),
|
||||
depends_on => { "mysql_cfg_created"};
|
||||
|
||||
services:
|
||||
"$(service_name)"
|
||||
depends_on => {"mysql_pkgs_installed"},
|
||||
|
@ -74,7 +81,83 @@ services:
|
|||
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
|
||||
{
|
||||
|
@ -178,19 +261,25 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
|||
|
||||
bundle agent create_mysql_db(cfg)
|
||||
{
|
||||
classes:
|
||||
"type_$(mysql.type)" ;
|
||||
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])";
|
||||
|
||||
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)'; \" ";
|
||||
|
||||
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:
|
||||
debian::
|
||||
"$(mysql.mysql_cmd)"
|
||||
args => "$(args)",
|
||||
inform => "false";
|
||||
|
||||
"$(mysql.mysql_cmd)"
|
||||
args => "$(args)",
|
||||
inform => "false";
|
||||
|
||||
reports:
|
||||
}
|
||||
|
|
5
php.cf
5
php.cf
|
@ -28,6 +28,11 @@ vars:
|
|||
"php$(bsdvs)-pdo_mysql",
|
||||
"php$(bsdvs)-pdo",
|
||||
"php$(bsdvs)-filter",
|
||||
"php$(bsdvs)-mbstring",
|
||||
"php$(bsdvs)-dom",
|
||||
"php$(bsdvs)-xml",
|
||||
"php$(bsdvs)-ctype",
|
||||
"php$(bsdvs)-intl",
|
||||
};
|
||||
# "php$(bsdvs)-json",
|
||||
|
||||
|
|
|
@ -58,8 +58,9 @@ methods:
|
|||
commands:
|
||||
roundcube_untar::
|
||||
"/usr/bin/tar"
|
||||
args => "xzvf $(dlfile) -C $(cfg[install_dir])",
|
||||
args => "xzf $(dlfile) -C $(cfg[install_dir]) && chown -R $(cfg[www_user]):$(cfg[www_group]) $(cfg[install_dir])",
|
||||
depends_on => {"roundcube_tgz_copied"},
|
||||
contain => wmde_cmd_useshell,
|
||||
handle => "roundcube_untarred";
|
||||
!roundcube_untar::
|
||||
"/usr/bin/true"
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
#
|
||||
# Managed by CFEngine
|
||||
# Created by CFEngine
|
||||
#
|
||||
|
||||
[client-server]
|
||||
port = {{vars.cfg.mysql.port}}
|
||||
socket = /run/mysqld/mysqld.sock
|
||||
|
||||
#[mysql]
|
||||
#prompt = \u@\h [\d]>\_
|
||||
#no_auto_rehash
|
||||
|
||||
[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::
|
||||
"vimrc" string => "/etc/vim/vimrc";
|
||||
"pkg" string => "vim";
|
||||
centos::
|
||||
centos|fedora::
|
||||
"vimrc" string => "/etc/vim/vimrc";
|
||||
"pkg" string => "vim-enhanced";
|
||||
|
||||
|
@ -28,7 +28,7 @@ packages:
|
|||
"$(pkg)"
|
||||
policy => "present",
|
||||
package_module => apt_get;
|
||||
centos::
|
||||
fedora|centos::
|
||||
"$(pkg)"
|
||||
policy => "present",
|
||||
package_module => yum;
|
||||
|
|
Loading…
Reference in New Issue