I'm provisioning a Vagrant bento/centos6.7
box using chef_solo
provisioner. I'm using berkshelf-plugin
for the cookbook dependencies.
My project folder looks like this:
|── Vagrantfile
|── cookbooks
└── my_cookbook
|── Berksfile
|── metadata.rb
...
Inside my Vagrantfile
(which is the default for bento/centos6.7
plus the following config)
config.berkshelf.enabled = true
config.berkshelf.berksfile_path = "cookbooks/my_cookbook/Berksfile"
config.vm.provision "chef_solo" do |chef|
chef.add_recipe "my_cookbook"
end
In my metadata.rb
depends 'mysql2_chef_gem', '~> 1.1'
depends 'database', '~> 5.1'
When I provision my vagrant machine, I get the following error:
Error executing action `create` on resource 'mysql_database[my_database]'
Mysql2::Error
-------------
Lost connection to MySQL server at 'reading initial communication packet', system error: 110
PS: it works perfectly on bento/centos7.2
EDIT: Here is the database creation part:
# Install the MySQL client
mysql_client 'default' do
action :create
end
# Configure the MySQL service
mysql_service 'default' do
initial_root_password node['webserver']['database']['root_password']
action [:create, :start]
end
# Install the mysql2 Ruby gem
mysql2_chef_gem 'default' do
action :install
end
mysql_database node['webserver']['database']['db_name'] do
connection(
:host => node['webserver']['database']['host'],
:username => node['webserver']['database']['root_username'],
:password => node['webserver']['database']['root_password']
)
action :create
end
EDIT 2: It doesn't really work on bento/centos7.2
. It doesn't crash, but MySQL seems to be dead and running sudo systemctl start mysqld
hangs.