Last active
January 22, 2016 19:36
-
-
Save tomasnorre/3b92bcc8527d4246decd to your computer and use it in GitHub Desktop.
Installing mySQL with Chef cookbooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#^syntax detection | |
site 'http://community.opscode.com/api/v1' | |
cookbook "ant", :git => "[email protected]:opscode-cookbooks/ant.git" | |
cookbook "apt", :git => "https://github.com/opscode-cookbooks/apt" | |
cookbook "git", :git => "[email protected]:opscode-cookbooks/git.git" | |
cookbook "apache2", :git => "[email protected]:onehealth-cookbooks/apache2.git" | |
cookbook "mysql", :git => "[email protected]:chef-cookbooks/mysql.git" | |
cookbook "php", :git => "[email protected]:opscode-cookbooks/php.git" | |
cookbook "nodejs", :git => "[email protected]:tomasnorre/nodejs-cookbook.git" | |
cookbook "hostsfile", :git => "[email protected]:customink-webops/hostsfile.git" | |
cookbook "composer", :git => "[email protected]:Morphodo/chef-composer.git" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Image: Ubuntu/trusty64 | |
It works with: debian/wheezy64 | |
When running: | |
$ knife solo cook root@hostname | |
Then i get: | |
[2016-01-22T15:36:38+00:00] ERROR: Running exception handlers | |
Running handlers complete | |
[2016-01-22T15:36:38+00:00] ERROR: Exception handlers complete | |
[2016-01-22T15:36:38+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out | |
Chef Client failed. 9 resources updated in 10.444681612 seconds | |
[2016-01-22T15:36:38+00:00] ERROR: mysql_service[default] (my_cookbook::mysql line 9) had an error: NoMethodError: undefined method `[]' for nil:NilClass | |
[2016-01-22T15:36:38+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1) | |
ERROR: RuntimeError: chef-solo failed. See output above. | |
When looking at: | |
https://github.com/chef-cookbooks/mysql | |
http://stackoverflow.com/questions/29810057/mysql-service-not-being-recognized-in-chef | |
And what else I have found it all looks correct to me. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name 'my_cookbook' | |
maintainer 'Tomas Norre Mikkelsen' | |
maintainer_email '[email protected]' | |
license 'All rights reserved' | |
description 'Description' | |
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) | |
version '0.1.0' | |
depends 'apache2' | |
depends 'mysql', '~> 6.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cookbook Name:: my_cookbook | |
# Recipe:: mysql | |
# | |
# Copyright 2016, Tomas Norre Mikkelsen | |
# | |
# All rights reserved - Do Not Redistribute | |
# | |
mysql_service 'default' do | |
port '3306' | |
version '5.5' | |
initial_root_password 'secret' | |
action [:create, :start] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment