It is very difficult for me to figure out how to install mysql cookbook ( https://supermarket.chef.io/cookbooks/mysql ) I followed the instructions, but for the first time I use Vagrant and Chef and I continue to get stuck when setting the recipe
This is my roaming file: http://pastebin.com/9Fgts4J6
This is my sheffil (I use a librarian): http://pastebin.com/EfxPrC9S
this is my custom recipe 'mysql_config' located at my_cookbooks / mysql_config / recipes / default.rb: http://pastebin.com/Zh5Y4z8b
this is the error i get:
==> default: ================================================================================ ==> default: Error executing action `create` on resource 'template[default :create /etc/mysql-default/conf.d/default.cnf]' ==> default: ================================================================================ ==> default: ==> default: Chef::Mixin::Template::TemplateError ==> default: ------------------------------------ ==> default: undefined method `name' for nil:NilClass
this is my console output when running vagrant up: http://pastebin.com/ekkhHHru
It seems like I am missing some configuration, but I donβt know where and where to place it, I was looking for tutorials, but mysql_cookbook and the tramp have changed a lot lately, so I could not find anything good from them. Any help on this would be greatly appreciated.
Strollers File:
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure(2) do |config| config.vm.box = "puphpet/debian75-x64" config.vm.synced_folder "../." config.vm.provision "shell" do |s| s.path = "provision/setup.sh" end config.vm.provision "chef_solo" do |chef| chef.cookbooks_path = ["./cookbooks", "./my_cookbooks"] chef.add_recipe "mysql_config" chef.json = { "mysql_config" => { "name" => "localhost" } } end end
User Recipe:
mysql_service 'default' do port '3306' version '5.5' name 'localhost' initial_root_password 'p4ssw0rd' action [:create, :start] end mysql_config 'default' do source 'my.cnf.erb' notifies :restart, 'mysql_service[default]' action :create end
My console output:
iMacBert:Vagrant bert$ vagrant reload --provision ==> default: Attempting graceful shutdown of VM... ==> default: Checking if box 'puphpet/debian75-x64' is up to date... ==> default: Clearing any previously set forwarded ports... ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat ==> default: Forwarding ports... default: 22 => 2222 (adapter 1) ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key default: Warning: Connection timeout. Retrying... ==> default: Machine booted and ready! ==> default: Checking for guest additions in VM... ==> default: Mounting shared folders... default: /vagrant => /Users/bert/Vagrant default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks => /Users/bert/Vagrant/cookbooks default: /tmp/vagrant-chef-3/chef-solo-2/cookbooks => /Users/bert/Vagrant/my_cookbooks ==> default: Running provisioner: shell... default: Running: /var/folders/y5/hhjgvl5j22g54t22yw8g7mbm0000gp/T/vagrant-shell20150108-3959-gkjuye.sh ==> default: stdin: is not a tty ==> default: Provisioning virtual machine... ==> default: Running provisioner: chef_solo... default: Installing Chef (latest)... Generating chef JSON and uploading... ==> default: Running chef-solo... ==> default: stdin: is not a tty ==> default: [2015-01-08T07:40:57+00:00] INFO: Forking chef instance to converge... ==> default: [2015-01-08T07:40:57+00:00] INFO: *** Chef 12.0.3 *** ==> default: [2015-01-08T07:40:57+00:00] INFO: Chef-client pid: 6289 ==> default: [2015-01-08T07:40:58+00:00] INFO: Setting the run_list to ["recipe[mysql_config]"] from CLI options ==> default: [2015-01-08T07:40:58+00:00] INFO: Run List is [recipe[mysql_config]] ==> default: [2015-01-08T07:40:58+00:00] INFO: Run List expands to [mysql_config] ==> default: [2015-01-08T07:40:58+00:00] INFO: Starting Chef Run for packer-virtualbox-iso.vagrantup.com ==> default: [2015-01-08T07:40:58+00:00] INFO: Running start handlers ==> default: [2015-01-08T07:40:58+00:00] INFO: Start handlers complete. ==> default: [2015-01-08T07:41:27+00:00] INFO: service[localhost :create mysql] stopped ==> default: [2015-01-08T07:41:27+00:00] INFO: file[localhost :create /etc/mysql/my.cnf] backed up to /var/chef/backup/etc/mysql/my.cnf.chef-20150108074127.236557 ==> default: [2015-01-08T07:41:27+00:00] INFO: file[localhost :create /etc/mysql/my.cnf] deleted file at /etc/mysql/my.cnf ==> default: [2015-01-08T07:41:27+00:00] INFO: link[localhost :create /usr/share/my-default.cnf] created ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /etc/mysql-localhost] created directory /etc/mysql-localhost ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /etc/mysql-localhost] owner changed to 105 ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /etc/mysql-localhost] group changed to 107 ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /etc/mysql-localhost] mode changed to 750 ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /etc/mysql-localhost/conf.d] created directory /etc/mysql-localhost/conf.d ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /etc/mysql-localhost/conf.d] owner changed to 105 ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /etc/mysql-localhost/conf.d] group changed to 107 ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /etc/mysql-localhost/conf.d] mode changed to 750 ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /run/mysql-localhost] created directory /run/mysql-localhost ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /run/mysql-localhost] owner changed to 105 ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /run/mysql-localhost] group changed to 107 ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /run/mysql-localhost] mode changed to 755 ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /var/log/mysql-localhost] created directory /var/log/mysql-localhost ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /var/log/mysql-localhost] owner changed to 105 ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /var/log/mysql-localhost] group changed to 107 ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /var/log/mysql-localhost] mode changed to 750 ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /var/lib/mysql-localhost] created directory /var/lib/mysql-localhost ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /var/lib/mysql-localhost] owner changed to 105 ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /var/lib/mysql-localhost] group changed to 107 ==> default: [2015-01-08T07:41:27+00:00] INFO: directory[localhost :create /var/lib/mysql-localhost] mode changed to 750 ==> default: [2015-01-08T07:41:27+00:00] INFO: template[localhost :create /etc/mysql-localhost/my.cnf] created file /etc/mysql-localhost/my.cnf ==> default: [2015-01-08T07:41:27+00:00] INFO: template[localhost :create /etc/mysql-localhost/my.cnf] updated file contents /etc/mysql-localhost/my.cnf ==> default: [2015-01-08T07:41:27+00:00] INFO: template[localhost :create /etc/mysql-localhost/my.cnf] owner changed to 105 ==> default: [2015-01-08T07:41:27+00:00] INFO: template[localhost :create /etc/mysql-localhost/my.cnf] group changed to 107 ==> default: [2015-01-08T07:41:27+00:00] INFO: template[localhost :create /etc/mysql-localhost/my.cnf] mode changed to 600 ==> default: [2015-01-08T07:41:27+00:00] INFO: bash[localhost :create initialize mysql database] ran successfully ==> default: [2015-01-08T07:41:27+00:00] INFO: bash[localhost :create initialize mysql database] sending run action to bash[localhost :create initial records] (delayed) ==> default: [2015-01-08T07:41:30+00:00] INFO: bash[localhost :create initial records] ran successfully ==> default: [2015-01-08T07:41:30+00:00] INFO: template[localhost :start /etc/init.d/mysql-localhost] created file /etc/init.d/mysql-localhost ==> default: [2015-01-08T07:41:30+00:00] INFO: template[localhost :start /etc/init.d/mysql-localhost] updated file contents /etc/init.d/mysql-localhost ==> default: [2015-01-08T07:41:30+00:00] INFO: template[localhost :start /etc/init.d/mysql-localhost] owner changed to 0 ==> default: [2015-01-08T07:41:30+00:00] INFO: template[localhost :start /etc/init.d/mysql-localhost] group changed to 0 ==> default: [2015-01-08T07:41:30+00:00] INFO: template[localhost :start /etc/init.d/mysql-localhost] mode changed to 755 ==> default: [2015-01-08T07:41:30+00:00] INFO: service[localhost :start mysql-localhost] enabled ==> default: [2015-01-08T07:41:32+00:00] INFO: service[localhost :start mysql-localhost] started ==> default: [2015-01-08T07:41:32+00:00] INFO: directory[default :create /etc/mysql-default/conf.d] created directory /etc/mysql-default/conf.d ==> default: [2015-01-08T07:41:32+00:00] INFO: directory[default :create /etc/mysql-default/conf.d] owner changed to 105 ==> default: [2015-01-08T07:41:32+00:00] INFO: directory[default :create /etc/mysql-default/conf.d] group changed to 107 ==> default: [2015-01-08T07:41:32+00:00] INFO: directory[default :create /etc/mysql-default/conf.d] mode changed to 750 ==> default: ==> default: ================================================================================ ==> default: Error executing action `create` on resource 'template[default :create /etc/mysql-default/conf.d/default.cnf]' ==> default: ================================================================================ ==> default: ==> default: Chef::Mixin::Template::TemplateError ==> default: ------------------------------------ ==> default: undefined method `name' for nil:NilClass ==> default: ==> default: Resource Declaration: ==> default: --------------------- ==> default: ==> default: # In /tmp/vagrant-chef-3/chef-solo-1/cookbooks/mysql/libraries/provider_mysql_config.rb ==> default: ==> default: ==> default: 38: template "#{new_resource.name} :create #{include_dir}/#{new_resource.config_name}.cnf" do ==> default: 39: path "#{include_dir}/#{new_resource.config_name}.cnf" ==> default: 40: owner new_resource.owner ==> default: 41: group new_resource.group ==> default: ==> default: 42: mode '0640' ==> default: 43: variables(new_resource.variables) ==> default: 44: source new_resource.source ==> default: 45: cookbook new_resource.cookbook ==> default: ==> default: 46: action :create ==> default: 47: end ==> default: ==> default: 48: end ==> default: ==> default: ==> default: Compiled Resource: ==> default: ------------------ ==> default: # Declared in /tmp/vagrant-chef-3/chef-solo-1/cookbooks/mysql/libraries/provider_mysql_config.rb:38:in `block in <class:MysqlConfig>' ==> default: ==> default: template("default :create /etc/mysql-default/conf.d/default.cnf") do ==> default: action [:create] ==> default: retries 0 ==> default: retry_delay 2 ==> default: ==> default: default_guard_interpreter :default ==> default: path "/etc/mysql-default/conf.d/default.cnf" ==> default: backup 5 ==> default: atomic_update true ==> default: ==> default: source "my.cnf.erb" ==> default: ==> default: declared_type :template ==> default: cookbook_name :mysql_config ==> default: owner "mysql" ==> default: ==> default: group "mysql" ==> default: ==> default: mode "0640" ==> default: ==> default: end ==> default: ==> default: ==> default: Template Context: ==> default: ----------------- ==> default: on line
source share