Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for Standard Edition #67

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions recipes/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,21 @@

Chef::Application.fatal!("node['sql_server']['server_sa_password'] must be set for this cookbook to run") if node['sql_server']['server_sa_password'].nil?

service_name = if node['sql_server']['instance_name'] == 'SQLEXPRESS'
"MSSQL$#{node['sql_server']['instance_name']}"
else
# SQLEXPRESS is used as an instance name in Standard or Enterprise installs
# SQL Server it will default to MSSQLSERVER. Any instance name used will
# have MSSQ$ appeneded to the front
service_name = if node['sql_server']['instance_name'] == 'MSSQLSERVER'
node['sql_server']['instance_name']
else
"MSSQL$#{node['sql_server']['instance_name']}"
end
# Agent name needs to be declared because if you use the SQL Agent, you need
# to restart both services as the Agent is dependent on the SQL Service
agent_service_name = if node['sql_server']['instance_name'] == 'MSSQLSERVER'
'SQLSERVERAGENT'
else
"SQLAgent$#{node['sql_server']['instance_name']}"
end

# Compute registry version based on sql server version
reg_version = node['sql_server']['reg_version'] ||
Expand Down Expand Up @@ -90,6 +100,8 @@
installer_type :custom
options "/q /ConfigurationFile=#{config_file_path} #{passwords_options}"
action :install
notifies :request_reboot, 'reboot[sql server install]'
returns [0, 42, 127, 3010]
end

# set the static tcp port
Expand All @@ -100,8 +112,25 @@
notifies :restart, "service[#{service_name}]", :immediately
end

# If you have declared an agent account it will restart both the
# agent service and the sql service. If not only the sql service
if node['sql_server']['agent_account']
service agent_service_name do
action [:start, :enable]
end
service service_name do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate definition of the service

action [:start, :enable]
end
end

service service_name do
action [:start, :enable]
end

# SQL Server requires a reboot to complete your install
reboot 'sql server install' do
action :nothing
reason 'Needs to reboot after installing SQL Server'
end

include_recipe 'sql_server::client'