I'm currently trying out chef - more precisely - to setup a simple lamp with it. My cookbook should contain apache2, mysql and php at sometime. Right now I'm stuck with mysql.
The cookbook I'm using: https://supermarket.getchef.com/cookbooks/mysql. My configuration is almost the same as on the cookbook guide page.
databag_secret = Chef::EncryptedDataBagItem.load_secret("/etc/chef/encrypted_data_bag_secret")
secrets_mysql = Chef::EncryptedDataBagItem.load("secrets", "mysql", databag_secret)
include_recipe "mysql::client"
include_recipe "mysql::server"
mysql_service 'default' do
allow_remote_root false
remove_anonymous_users true
remove_test_database true
#server_root_password secrets_mysql['mysql_root_pass']
server_debian_password 'vagrantsuxx'
action :create
end
Retrieving my secret from the data bag works just fine and the first run of my cookbook always passes. Whenever I try to run it a second time it get the following error:
[2014-07-22T14:32:01+00:00] ERROR: Running exception handlers
Running handlers complete
[2014-07-22T14:32:01+00:00] ERROR: Exception handlers complete
[2014-07-22T14:32:01+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 5 resources updated in 6.99007798 seconds
[2014-07-22T14:32:01+00:00] ERROR: mysql_service[default] (mysql::server line 20) had an error: Mixlib::ShellOut::ShellCommandFailed: execute[install-grants] (/var/chef/cache/cookbooks/mysql/libraries/provider_mysql_service_ubuntu.rb line 91) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /usr/bin/mysql -u root -pilikerandompasswords < /etc/mysql_grants.sql ----
STDOUT:
STDERR: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
---- End output of /usr/bin/mysql -u root -pilikerandompasswords < /etc/mysql_grants.sql ----
Ran /usr/bin/mysql -u root -pilikerandompasswords < /etc/mysql_grants.sql returned 1
[2014-07-22T14:32:01+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
I wonder why that is. The passwords on /etc/mysql_grants.sql are somehow getting reset. Anyone else experienced this? What am I missing?
mysql_grants.sql
file. Does MySQL really store permissions in a plain file like that? So you check the contents of the file after each run and it's different after each run? – Patrick M