Skip to content

Instantly share code, notes, and snippets.

@someara
Created November 15, 2012 00:29
Show Gist options
  • Save someara/4075837 to your computer and use it in GitHub Desktop.
Save someara/4075837 to your computer and use it in GitHub Desktop.
#
# Cookbook Name:: myface
# Recipe:: default
#
# Copyright (C) 2012 Sean OMeara
#
# Apache 2 license
#
user 'myface'
include_recipe "mysql::server"
include_recipe "mysql::ruby"
mysql_database 'myface' do
connection ({
:host => "localhost",
:username => 'root',
:password => node['mysql']['server_root_password']
})
action :create
end
cookbook_file "/tmp/myface-init.sql" do
source "myface-init.sql"
owner "root"
mode "644"
end
execute "initialize myface database" do
command "mysql -h localhost -u root -p#{node['mysql']['server_root_password']} -D myface < /tmp/myface-init.sql"
not_if "mysql -h localhost -u root -p#{node['mysql']['server_root_password']} -D myface -e 'describe users;'"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment