Skip to content

Instantly share code, notes, and snippets.

@popsikle
Created September 22, 2015 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save popsikle/4d83636d6ca731a7b338 to your computer and use it in GitHub Desktop.
Save popsikle/4d83636d6ca731a7b338 to your computer and use it in GitHub Desktop.
mariadb_gem_requirements
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
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