Created
September 22, 2015 21:10
-
-
Save popsikle/4d83636d6ca731a7b338 to your computer and use it in GitHub Desktop.
mariadb_gem_requirements
This file contains hidden or 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
module DBGems | |
module Mariadb | |
def mariadb_gem_requirements | |
system "apt-get install -y software-properties-common" | |
system "apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db" | |
system "add-apt-repository 'deb http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu trusty main'" | |
system "apt-get update -y" | |
system "apt-get install -y mariadb-client libmariadbclient-dev" | |
end | |
end | |
end |
This file contains hidden or 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
Chef::Recipe.send(:include, DBGems::Mariadb) | |
mariadb_gem_requirements | |
begin | |
require 'mysql' | |
rescue LoadError | |
chef_gem 'mysql' | |
end | |
ruby_block "do_some_msql_stuff" do | |
block do | |
require 'mysql' | |
m = Mysql.new("127.0.0.1", "root", "#{root_pass}") | |
m.query("show master status") do |row| | |
end | |
end | |
only_if "pgrep 'mysqld$'" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment