Skip to content

Instantly share code, notes, and snippets.

@russ
Created August 30, 2012 16:53
Show Gist options
  • Save russ/3533101 to your computer and use it in GitHub Desktop.
Save russ/3533101 to your computer and use it in GitHub Desktop.
::Chef::Recipe.send(:include, Opscode::OpenSSL::Password)
app = data_bag_item('apps', 'bulletin_board')
app['mysql_root_password'][node.chef_environment] = node['mysql']['server_root_password']
app['databases'][node.chef_environment]['password'] = secure_password
app.save
chef_gem 'mysql' do
action :install
end
mysql_database 'bulletin_board' do
connection ({
:host => 'localhost',
:username => 'root',
:password => node['mysql']['server_root_password']})
action :create
end
mysql_connection_info = {
:host => 'localhost',
:username => 'root',
:password => node['mysql']['server_root_password']
}
mysql_database_user 'lvrug' do
connection mysql_connection_info
password data_bag_item('apps', 'bulletin_board')['databases'][node.chef_environment]['password']
action :create
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment