From 7ef391caabed230d965e6133bb83cb2de9fb9999 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Fri, 19 Dec 2014 14:36:32 +0000 Subject: [PATCH] Fix the database dependencies - Don't include MySQL recipes when not using MySQL. - Don't include mysql::client at all, database::mysql is sufficient. - Do include database::postgresql when using PostgreSQL. - Bump database dependency due to breaking changes in mysql-chef_gem. - Demote mysql and postgresql cookbooks to "suggests" as they are not strictly required. --- README.md | 12 ------------ Vagrantfile | 1 - metadata.rb | 6 +++--- recipes/database.rb | 6 +++--- 4 files changed, 6 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 0d8e3e3..2b48b5f 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,6 @@ Installing the Database : Installing all 3 - Database MUST come before Server - "recipe[database::mysql]", "recipe[mysql::server]", "recipe[zabbix]", "recipe[zabbix::database]", @@ -193,17 +192,6 @@ You can control the server and web installs with the following attributes: node['zabbix']['server']['install_method'] = 'source' node['zabbix']['web']['install'] = true -If you are using a MySql or RDS MySql database make sure your runlist -includes: - - "recipe[database::mysql]", - "recipe[mysql::client]" - -If you are user a Postgres database make sure your runlist includes: - - "recipe[database::postgresql]", - "recipe[postgresql::client]", - ## server\_source Downloads and installs the Zabbix Server component from source diff --git a/Vagrantfile b/Vagrantfile index 7f50879..b072db5 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -51,7 +51,6 @@ Vagrant.configure("2") do |config| } } - chef.add_recipe "database::mysql" chef.add_recipe "mysql::server" chef.add_recipe "zabbix" chef.add_recipe "zabbix::database" diff --git a/metadata.rb b/metadata.rb index 6936993..466d0f2 100644 --- a/metadata.rb +++ b/metadata.rb @@ -12,11 +12,9 @@ supports 'oracle', '>= 5.0' supports 'windows' depends 'apache2', '>= 1.0.8' -depends 'database', '>= 1.3.0' -depends 'mysql', '>= 1.3.0' +depends 'database', '>= 2.3.1' depends 'ufw', '>= 0.6.1' depends 'yum' -depends 'postgresql' depends 'php-fpm' depends 'nginx', '>= 1.0.0' depends 'ark', '>= 0.7.2' @@ -25,3 +23,5 @@ depends 'oracle-instantclient' depends 'php' depends 'yum-epel' +suggests 'mysql' +suggests 'postgresql' diff --git a/recipes/database.rb b/recipes/database.rb index c11f59c..bbbdb8b 100644 --- a/recipes/database.rb +++ b/recipes/database.rb @@ -2,9 +2,6 @@ ::Chef::Recipe.send(:include, Opscode::OpenSSL::Password) -include_recipe 'database::mysql' -include_recipe 'mysql::client' - # Generates passwords if they aren't already set # This is INSECURE because node.normal persists the passwords to the chef # server, making them visible to anybody with access @@ -18,11 +15,13 @@ case node['zabbix']['database']['install_method'] when 'rds_mysql' + include_recipe 'database::mysql' root_username = node['zabbix']['database']['rds_master_username'] root_password = node['zabbix']['database']['rds_master_password'] allowed_user_hosts = '%' provider = Chef::Provider::ZabbixDatabaseMySql when 'mysql' + include_recipe 'database::mysql' unless node['mysql']['server_root_password'] node.normal['mysql']['server_root_password'] = secure_password end @@ -31,6 +30,7 @@ allowed_user_hosts = node['zabbix']['database']['allowed_user_hosts'] provider = Chef::Provider::ZabbixDatabaseMySql when 'postgres' + include_recipe 'database::postgresql' unless node['postgresql']['password']['postgres'] node.normal['postgresql']['password']['postgres'] = secure_password end