Skip to content

Instantly share code, notes, and snippets.

@cixelsyd
Created December 17, 2011 20:49
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 cixelsyd/1491338 to your computer and use it in GitHub Desktop.
Save cixelsyd/1491338 to your computer and use it in GitHub Desktop.
"createdb.rb" creates empty MSSQL databases from settings inside data bags
#
# Author:: Steven Craig <support@smashrun.com>
# Cookbook Name:: windows
# Attributes:: createdb
#
# Copyright 2010, Smashrun, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# these are standard
default[:createdb][:author_name] = "Steve Craig"
default[:createdb][:author_email] = "support@smashrun.com"
default[:createdb][:tempdir] = "c:\\chef\\tmp\\"
# shared among all db instances
default[:createdb][:sqlscripts] = "D:\\MSSQL\\sqlscripts"
# this is a DIRTY hack because i didnt spend the time to get the directory working inside the backup_db.rb script
# this should be fixed to be a solr search from the databag AS SOON AS POSSIBLE
default[:createdb][:backupdir] = "D:\\MSSQL\\Backup"
default[:createdb][:restoredir] = "D:\\MSSQL\\Restore"
# utilized primarily by the templates
default[:createdb][:sqlsausername] = "sa"
# this should be an if..then depending on the version of SQL Server (future functionality)
default[:createdb][:sqlcmd_path] = "C:\\Program Files\\Microsoft SQL Server\\90\\Tools\\Binn"
default[:createdb][:executesql_bat] = "execute_sql.bat"
default[:createdb][:executesql_template] = "createdb-#{node[:createdb][:executesql_bat]}.erb"
default[:createdb][:basesql] = "create.sql"
# sql tools future functionality
if node[:kernel][:machine] == "x86_64"
default[:createdb][:url] = "http://localhost"
default[:createdb][:installer] = "sql_bundle.exe"
else
if node[:kernel][:machine] == "i386"
default[:createdb][:url] = "http://localhost"
default[:createdb][:installer] = "sql_bundle.exe"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment