├── .editorconfig ├── .envrc ├── .gitattributes ├── .github ├── CODEOWNERS └── workflows │ ├── ci.yml │ └── stale.yml ├── .gitignore ├── .markdownlint-cli2.yaml ├── .mdlrc ├── .overcommit.yml ├── .vscode └── extensions.json ├── .yamllint ├── Berksfile ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dangerfile ├── LICENSE ├── README.md ├── TESTING.md ├── chefignore ├── documentation ├── .gitkeep ├── sql_server_configure.md └── sql_server_install.md ├── kitchen.dokken.yml ├── kitchen.exec.yml ├── kitchen.global.yml ├── kitchen.yml ├── libraries └── helper.rb ├── metadata.rb ├── renovate.json ├── resources ├── client_install.rb ├── configure.rb └── install.rb ├── spec └── spec_helper.rb ├── templates └── ConfigurationFile.ini.erb └── test ├── cookbooks └── test │ ├── metadata.rb │ └── recipes │ ├── default.rb │ └── enterprise.rb └── integration └── server_install ├── controls ├── client_spec.rb └── server_spec.rb └── inspec.yml /.editorconfig: -------------------------------------------------------------------------------- 1 | # https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root=true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | 11 | # 2 space indentation 12 | indent_style = space 13 | indent_size = 2 14 | 15 | # Avoid issues parsing cookbook files later 16 | charset = utf-8 17 | 18 | # Avoid cookstyle warnings 19 | trim_trailing_whitespace = true 20 | -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | use chefworkstation 2 | export KITCHEN_GLOBAL_YAML=kitchen.global.yml 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @sous-chefs/maintainers 2 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: ci 3 | 4 | "on": 5 | pull_request: 6 | push: 7 | branches: [main] 8 | 9 | jobs: 10 | lint-unit: 11 | uses: sous-chefs/.github/.github/workflows/lint-unit.yml@3.1.1 12 | with: 13 | platform: windows-latest 14 | permissions: 15 | actions: write 16 | checks: write 17 | pull-requests: write 18 | statuses: write 19 | issues: write 20 | # This needs to run on vagrant due to the fact these nodes reboot during their 21 | # runs 22 | integration: 23 | needs: lint-unit 24 | runs-on: macos-latest 25 | strategy: 26 | matrix: 27 | os: 28 | - "windows-2019" 29 | suite: 30 | - "default" 31 | # - "client" 32 | # - "install" 33 | # - "server2016" 34 | # - "server2017" 35 | # - "server2019" 36 | fail-fast: false 37 | 38 | steps: 39 | - name: Check out code 40 | uses: actions/checkout@v4 41 | - name: Install Chef 42 | uses: actionshub/chef-install@3.0.0 43 | - name: test-kitchen 44 | uses: actionshub/test-kitchen@3.0.0 45 | env: 46 | CHEF_LICENSE: accept-no-persist 47 | with: 48 | suite: ${{ matrix.suite }} 49 | os: ${{ matrix.os }} 50 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Mark stale issues and pull requests 3 | 4 | "on": 5 | schedule: [cron: "0 0 * * *"] 6 | 7 | jobs: 8 | stale: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/stale@v9 12 | with: 13 | repo-token: ${{ secrets.GITHUB_TOKEN }} 14 | close-issue-message: > 15 | Closing due to inactivity. 16 | If this is still an issue please reopen or open another issue. 17 | Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help! 18 | Thanks, Sous-Chefs. 19 | days-before-close: 7 20 | days-before-stale: 365 21 | stale-issue-message: > 22 | Marking stale due to inactivity. 23 | Remove stale label or comment or this will be closed in 7 days. 24 | Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help! 25 | Thanks, Sous-Chefs. 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.rbc 2 | .config 3 | InstalledFiles 4 | pkg 5 | test/tmp 6 | test/version_tmp 7 | tmp 8 | _Store 9 | *~ 10 | *# 11 | .#* 12 | \#*# 13 | *.un~ 14 | *.tmp 15 | *.bk 16 | *.bkup 17 | 18 | # editor files 19 | .idea 20 | .*.sw[a-z] 21 | 22 | # ruby/bundler/rspec files 23 | .ruby-version 24 | .ruby-gemset 25 | .rvmrc 26 | Gemfile.lock 27 | .bundle 28 | *.gem 29 | coverage 30 | spec/reports 31 | 32 | # YARD / rdoc artifacts 33 | .yardoc 34 | _yardoc 35 | doc/ 36 | rdoc 37 | 38 | # chef infra stuff 39 | Berksfile.lock 40 | .kitchen 41 | kitchen.local.yml 42 | vendor/ 43 | .coverage/ 44 | .zero-knife.rb 45 | Policyfile.lock.json 46 | 47 | # vagrant stuff 48 | .vagrant/ 49 | .vagrant.d/ 50 | -------------------------------------------------------------------------------- /.markdownlint-cli2.yaml: -------------------------------------------------------------------------------- 1 | config: 2 | ul-indent: false # MD007 3 | line-length: false # MD013 4 | no-duplicate-heading: false # MD024 5 | reference-links-images: false # MD052 6 | ignores: 7 | - .github/copilot-instructions.md 8 | -------------------------------------------------------------------------------- /.mdlrc: -------------------------------------------------------------------------------- 1 | rules "~MD013", "~MD024", "~MD025" 2 | -------------------------------------------------------------------------------- /.overcommit.yml: -------------------------------------------------------------------------------- 1 | --- 2 | PreCommit: 3 | TrailingWhitespace: 4 | enabled: true 5 | YamlLint: 6 | enabled: true 7 | required_executable: "yamllint" 8 | ChefSpec: 9 | enabled: true 10 | required_executable: "chef" 11 | command: ["chef", "exec", "rspec"] 12 | Cookstyle: 13 | enabled: true 14 | required_executable: "cookstyle" 15 | command: ["cookstyle"] 16 | MarkdownLint: 17 | enabled: false 18 | required_executable: "npx" 19 | command: ["npx", "markdownlint-cli2", "'**/*.md'"] 20 | include: ["**/*.md"] 21 | 22 | CommitMsg: 23 | HardTabs: 24 | enabled: true 25 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "chef-software.chef", 4 | "rebornix.ruby", 5 | "editorconfig.editorconfig", 6 | "DavidAnson.vscode-markdownlint" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | --- 2 | extends: default 3 | rules: 4 | line-length: 5 | max: 256 6 | level: warning 7 | document-start: disable 8 | braces: 9 | forbid: false 10 | min-spaces-inside: 0 11 | max-spaces-inside: 1 12 | min-spaces-inside-empty: -1 13 | max-spaces-inside-empty: -1 14 | comments: 15 | min-spaces-from-content: 1 16 | -------------------------------------------------------------------------------- /Berksfile: -------------------------------------------------------------------------------- 1 | source 'https://supermarket.chef.io' 2 | 3 | metadata 4 | 5 | group :integration do 6 | cookbook 'test', path: './test/cookbooks/test' 7 | end 8 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # sql_server Cookbook CHANGELOG 2 | 3 | This file is used to list changes made in each version of the sql_server cookbook. 4 | 5 | ## Unreleased 6 | 7 | ## 8.0.4 - *2024-11-18* 8 | 9 | Standardise files with files in sous-chefs/repo-management 10 | 11 | Standardise files with files in sous-chefs/repo-management 12 | 13 | Standardise files with files in sous-chefs/repo-management 14 | 15 | Standardise files with files in sous-chefs/repo-management 16 | 17 | Standardise files with files in sous-chefs/repo-management 18 | 19 | ## 8.0.3 - *2024-05-01* 20 | 21 | ## 8.0.2 - *2024-05-01* 22 | 23 | ## 8.0.1 - *2023-10-31* 24 | 25 | ## 8.0.0 - *2023-09-28* 26 | 27 | - Remove recipes and attributes 28 | - Remove duplicate _ConfigurationFile.ini.erb 29 | - Remove specs for recipes 30 | - Move the InSpec test to the correct directory 31 | 32 | ## 7.2.6 - *2023-09-28* 33 | 34 | ## 7.2.5 - *2023-09-04* 35 | 36 | ## 7.2.4 - *2023-07-10* 37 | 38 | ## 7.2.3 - *2023-05-17* 39 | 40 | ## 7.2.2 - *2023-05-10* 41 | 42 | - Use reusable lint-unit workflow 43 | 44 | ## 7.2.1 - *2023-04-07* 45 | 46 | Standardise files with files in sous-chefs/repo-management 47 | 48 | ## 7.2.0 - *2023-04-04* 49 | 50 | - Added support for SQL 2022 via resource installation method 51 | 52 | ## 7.1.13 - *2023-04-01* 53 | 54 | ## 7.1.12 - *2023-04-01* 55 | 56 | ## 7.1.11 - *2023-04-01* 57 | 58 | Standardise files with files in sous-chefs/repo-management 59 | 60 | ## 7.1.10 - *2023-03-20* 61 | 62 | Standardise files with files in sous-chefs/repo-management 63 | 64 | ## 7.1.9 - *2023-03-15* 65 | 66 | Standardise files with files in sous-chefs/repo-management 67 | 68 | ## 7.1.8 - *2023-02-27* 69 | 70 | Standardise files with files in sous-chefs/repo-management 71 | 72 | ## 7.1.7 - *2023-02-20* 73 | 74 | ## 7.1.6 - *2023-02-16* 75 | 76 | Standardise files with files in sous-chefs/repo-management 77 | 78 | ## 7.1.5 - *2023-02-14* 79 | 80 | Standardise files with files in sous-chefs/repo-management 81 | 82 | ## 7.1.4 - *2023-02-14* 83 | 84 | ## 7.1.3 - *2022-12-13* 85 | 86 | Standardise files with files in sous-chefs/repo-management 87 | 88 | Standardise files with files in sous-chefs/repo-management 89 | 90 | ## 7.1.2 - *2022-02-08* 91 | 92 | - Remove delivery folder 93 | 94 | ## 7.1.1 - *2022-02-03* 95 | 96 | Standardise files with files in sous-chefs/repo-management 97 | 98 | ## 7.1.0 - *2021-10-01* 99 | 100 | - Adds parameter for tempdb data and log file initial size 101 | - Adds parameter for number of tempdb data files to create 102 | - Adds parameter for granting instant file initialization to Sql Server service account. 103 | 104 | ## 7.0.0 - *2021-09-08* 105 | 106 | - Set environment flag to accept chef licence for CI jobs 107 | - Allow unsecure commands in windows CI jobs, needed for chef to install. 108 | - Remove windows cookbook dependency as it is no longer maintained. 109 | 110 | ## 6.2.3 - *2021-08-30* 111 | 112 | - Standardise files with files in sous-chefs/repo-management 113 | 114 | ## 6.2.2 - *2021-06-01* 115 | 116 | - Standardise files with files in sous-chefs/repo-management 117 | 118 | ## 6.2.1 - *2021-05-06* 119 | 120 | - Adding new checksums for Windows 20212 SQL component .msi packages 121 | 122 | ## 6.2.0 - *2021-03-02* 123 | 124 | - Sous Chefs Adoption 125 | - Add proper InSpec tests 126 | - Remove `windows_path` resource in client recipe as it's not needed anymore 127 | - Set `netfx35_install` to false by default as it fails currently otherwise 128 | 129 | ## 6.1.0 (2020-06-24) 130 | 131 | - Cookstyle 6.2.9 Fixes - [@xorimabot](https://github.com/xorimabot) 132 | - Standardise files with files in chef-cookbooks/repo-management - [@xorimabot](https://github.com/xorimabot) 133 | - [GH-146] SQL 2019 Support 134 | 135 | ## 6.0.0 (2020-02-19) 136 | 137 | This release removes support for deprecated SQL Server, Chef Infra Client, and Windows OS releases: 138 | 139 | - Require Chef Infra Client 13+ 140 | - Remove support for Windows 2008 R2 141 | - Remove support for SQL Server 2008 and 2014 142 | 143 | ## 5.6.0 (2020-02-18) 144 | 145 | - Resolve multiple Cookstyle warnings - [@tas50](https://github.com/tas50) 146 | - Remove unused long_description metadata - [@tas50](https://github.com/tas50) 147 | - Remove unnecessary foodcritic comments - [@tas50](https://github.com/tas50) 148 | - Remove windows 2008 r2 specs - [@tas50](https://github.com/tas50) 149 | - Fix to install SQL on any custom directory - [@bhavya5491](https://github.com/bhavya5491) 150 | - Require Chef 12.15+ - [@tas50](https://github.com/tas50) 151 | - Updated checksum for 2008R2 - [@kenlangdon](https://github.com/kenlangdon) 152 | 153 | ## 5.5.1 (2019-06-05) 154 | 155 | - Example resources should not have backticks but single quotes - [@gsreynolds](https://github.com/gsreynolds) 156 | - Added the ability to override ASSVCACCOUNT in the Configuration File - [@jcurcio](https://github.com/jcurcio) 157 | 158 | ## 5.5.0 (2018-02-10) 159 | 160 | - Add property to make .Net 3.5 install optional 161 | 162 | ## 5.4.1 (2018-01-10) 163 | 164 | - Fix .kitchen.yml file for chef 12.7 testing 165 | - Fix typo with sysadmins property 166 | - Fix feature_list property in ConfigurationFile.ini 167 | 168 | ## 5.4.0 (2018-01-03) 169 | 170 | - Add `install` custom resource that installs the specified version of SQL Server 171 | - Add `configure` custom resource that configures SQL ports and services 172 | - Bump minimum chef version to 12.7 173 | - Update readme to support new resources (#92) 174 | - Add support of SQL 2017 to the resource 175 | - Add support to all features to custom resources 176 | - Recommend wrapper cookbook over backwards compatible recipes 177 | - Update licensing for the new year 178 | 179 | ## 5.3.2 (2017-10-14) 180 | 181 | - Change default version to 2012 in the readme 182 | - Remove maintainer files and add info to the readme 183 | - Clarifies password in the readme 184 | - Clean up broken link in README 185 | 186 | ## 5.3.1 (2017-03-27) 187 | 188 | - Update windows cookbook dependency to 3.0.0 due to changes to windows_feature resource. (#89) 189 | - Fix reboot post install logic. (#90) 190 | 191 | ## 5.3.0 (2017-03-17) 192 | 193 | - Update SQL 2016 Express URL to SP1 and update readme to reflect support for 2016. (#88) 194 | 195 | ## 5.2.1 (2017-03-08) 196 | 197 | - Add appveyer integration testing of the client recipe and remove Travis CI testing (#86) 198 | 199 | ## 5.2.0 (2017-03-07) 200 | 201 | - Test with Local Delivery instead of Rake 202 | - Fix failures on Windows 2008r2 by installing NetFx3 if necessary 203 | 204 | ## 5.1.2 (2017-01-31) 205 | 206 | - Fix issue with Deprecation:Some Attribute Methods (CHEF-4) error 207 | 208 | ## 5.1.1 (2017-01-16) 209 | 210 | - Only start and enable agent if agent_startup is set to automatic 211 | 212 | ## 5.1.0 (2016-12-20) 213 | 214 | - Move server configuration in a new `sql_server::configure` recipe 215 | - Add attributes to control network listeners via registry keys. 216 | 217 | ## 5.0.0 (2016-11-22) 218 | 219 | - Avoid deprecation warnings with `windows_package` by using package instead. This requires Chef 12.6+ and Windows cookbook 2.0+ 220 | - Adding support for SQL Server Version 2014 221 | - Default to SQL Server 2012 222 | - Move a good chunk of the version logic to helpers instead of doing it in the recipes 223 | - Use secure links to download older SQL express releases 224 | - Add basic sql express 2016 support 225 | - Don’t fail if the SQL version specified is an int and not a string 226 | - Avoid blank lines if the optional configs aren’t passed 227 | 228 | ## 4.0.0 (2016-11-18) 229 | 230 | - Remove relation between client & server recipes. This was not working correctly. You'll want to include both if you want client packages on your server now. 231 | - Added Filestream Support 232 | - Improved password escaping 233 | - Remove SQL Server 2008 R2 / 2008 R2 SP1\. You must now be using 2008 R2 SP2+ 234 | 235 | ## 3.0.0 (2016-09-07) 236 | 237 | - Correct attribute to accept eula 238 | - Require Chef 12+ 239 | - Testing updates 240 | 241 | ## v2.6.2(2016-05-17) 242 | 243 | - README updates 244 | 245 | ## v2.6.1(2016-05-17) 246 | 247 | - [PR #69](https://github.com/chef-cookbooks/sql_server/pull/69) Duplicate service restart 248 | - Clean up rake file, maintainers toml/markdown 249 | 250 | ## v2.6.0(2016-05-17) 251 | 252 | - [PR #59](https://github.com/chef-cookbooks/sql_server/pull/59) Support Named Instances 253 | - [PR #61](https://github.com/chef-cookbooks/sql_server/pull/61) Restart Command For SQL Server 254 | - [PR #67](https://github.com/chef-cookbooks/sql_server/pull/67) Updates for Standard Edition 255 | - [PR #68](https://github.com/chef-cookbooks/sql_server/pull/68) Clarify remote install note 256 | 257 | ## v2.5.0(2016-02-12) 258 | 259 | - Enable multiple sysadmin names. 260 | - Removed the logic that auto generated node['sql_server']['server_sa_password'] and saved it to the node. The user will now need to set this to use the server recipe 261 | - Removed the gem install of tiny_tds. This is not directly used by this cookbook. If you require this for the database cookbook you should install it in your own wrapper cookbook. 262 | - Added support for SQL Server Client 2008 R2 SP2/SP2 and 2012 package installation 263 | - Added the ability to specify the directories for system dbs, user dbs, logs, and tempdb in ConfigurationFile.ini 264 | - Removed assumptions that C: is your system drive 265 | - Added support SQL 2014 server in ConfigurationFile.ini 266 | - Added the ability to pass account passwords to the installer vs. placing them in ConfigurationFile.ini 267 | - Added ability to configure tempdb path, sqlbackupdir path, and sqlcollation in ConfigurationFile.ini 268 | - Fixed computation of the reg_version and service_name variables 269 | - Clarified the system and chef requirements in the readme 270 | - Removed the Berksfile.lock 271 | - Added Test Kitchen config with client and server suite 272 | - Added updated contributing and testing docs 273 | - Added Travis config 274 | - Added Rakefile for simplified testing 275 | - Added Rubocop config and resolved all warnings 276 | - Added Gemfile with testing deps 277 | - Added Maintainers files 278 | - Added travis and cookbook version badges to the readme 279 | - Added source_url and issues_url metadata for Supermarket 280 | 281 | ## v2.4.0 (2014-08-13) 282 | 283 | - Fixing Checksums 284 | - Changes to attribute interface 285 | 286 | ## v2.2.3 (2014-02-18) 287 | 288 | - reverting OpenSSL module namespace change 289 | 290 | ## v2.2.2 (2014-02-17) 291 | 292 | - updating to use the latest openssl 293 | 294 | ## v2.2.0 (2014-03-27) 295 | 296 | - [COOK-4355] - Fix support for SQL server by using the right registry path 297 | 298 | ## v2.0.0 (2014-02-27) 299 | 300 | [COOK-4253] - Make install options configurable 301 | 302 | ## v1.4.4 (2014-02-21) 303 | 304 | ### Improvement 305 | 306 | - sql_server does not support installing SQL 2012 307 | 308 | ## v1.4.1 (2014-02-21) 309 | 310 | ### Improvement 311 | 312 | - sql_server cookbook uses deprecated windows_registry LWRP 313 | 314 | ### Bug 315 | 316 | - sql_server randomly-generated SA password sometimes not strong enough 317 | 318 | ## v1.3.0 319 | 320 | ### Improvement 321 | 322 | - Broken SQLExpress download links... 323 | 324 | ### Bug 325 | 326 | - SQLEXPRESS on 32 bits systems does not support INSTALLSHAREDWOWDIR 327 | - Mixlib::ShellOut::CommandTimeout: command timed out error 328 | 329 | ## v1.2.2 330 | 331 | - See (v1.2.1), made a mistake with DevOdd releases 332 | 333 | ## v1.2.1 334 | 335 | ### Improvement 336 | 337 | - Allow setting feature_list 338 | 339 | ## v1.2.0 340 | 341 | ### Bug 342 | 343 | - Sql server configuration is incorrect when trying to install non-express version 344 | 345 | ## v1.1.0 346 | 347 | - remove unneeded external restart script from sql_server::server recipe 348 | 349 | ## v1.0.4 350 | 351 | - bump windows cookbook dependency version to pick up Ruby 1.9 compat fixes 352 | 353 | ## v1.0.2 354 | 355 | - win_friendly_path is no longer a module_function 356 | - rename accept_license_terms attribute to accept_eula for consistency with other cookbooks like iis 357 | 358 | ## v1.0.0 359 | 360 | - Initial release 361 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Community Guidelines 2 | 3 | This project follows the Chef Community Guidelines 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Please refer to 4 | [https://github.com/chef-cookbooks/community_cookbook_documentation/blob/main/CONTRIBUTING.MD](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/main/CONTRIBUTING.MD) 5 | -------------------------------------------------------------------------------- /Dangerfile: -------------------------------------------------------------------------------- 1 | # Reference: http://danger.systems/reference.html 2 | 3 | # A pull request summary is required. Add a description of the pull request purpose. 4 | # Changelog must be updated for each pull request that changes code. 5 | # Warnings will be issued for: 6 | # Pull request with more than 400 lines of code changed 7 | # Pull reqest that change more than 5 lines without test changes 8 | # Failures will be issued for: 9 | # Pull request without summary 10 | # Pull requests with code changes without changelog entry 11 | 12 | def code_changes? 13 | code = %w(libraries attributes recipes resources files templates) 14 | code.each do |location| 15 | return true unless git.modified_files.grep(/#{location}/).empty? 16 | end 17 | false 18 | end 19 | 20 | def test_changes? 21 | tests = %w(spec test kitchen.yml kitchen.dokken.yml) 22 | tests.each do |location| 23 | return true unless git.modified_files.grep(/#{location}/).empty? 24 | end 25 | false 26 | end 27 | 28 | failure 'Please provide a summary of your Pull Request.' if github.pr_body.length < 10 29 | 30 | warn 'This is a big Pull Request.' if git.lines_of_code > 400 31 | 32 | warn 'This is a Table Flip.' if git.lines_of_code > 2000 33 | 34 | # Require a CHANGELOG entry for non-test changes. 35 | if !git.modified_files.include?('CHANGELOG.md') && code_changes? 36 | failure 'Please include a CHANGELOG entry.' 37 | end 38 | 39 | # Require Major Minor Patch version labels 40 | unless github.pr_labels.grep /minor|major|patch/i 41 | warn 'Please add a release label to this pull request' 42 | end 43 | 44 | # A sanity check for tests. 45 | if git.lines_of_code > 5 && code_changes? && !test_changes? 46 | warn 'This Pull Request is probably missing tests.' 47 | end 48 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # sql_server Cookbook 2 | 3 | [![Cookbook Version](https://img.shields.io/cookbook/v/sql_server.svg)](https://supermarket.chef.io/cookbooks/sql_server) 4 | [![CI 5 | State](https://github.com/sous-chefs/sql_server/workflows/ci/badge.svg)](https://github.com/sous-chefs/sql_server/actions?query=workflow%3Aci) 6 | [![OpenCollective](https://opencollective.com/sous-chefs/backers/badge.svg)](#backers) 7 | [![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors) 8 | [![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) 9 | 10 | Provides resources for the installation and configuration of Microsoft SQL Server server and client. Includes several basic recipes that utilize install and configure resources. See the usage section below for more information. 11 | 12 | ## Maintainers 13 | 14 | This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working 15 | together to maintain important cookbooks. If you’d like to know more please visit 16 | [sous-chefs.org](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in 17 | [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF). 18 | 19 | ## Requirements 20 | 21 | ### Platforms 22 | 23 | - Windows Server 2012 (R1, R2) 24 | - Windows Server 2016 25 | - Windows Server 2019 26 | 27 | ### Supported Server Verions 28 | 29 | - Microsoft SQL Server 2012 30 | - Microsoft SQL Server 2016 31 | - Microsoft SQL Server 2017 32 | - Microsoft SQL Server 2019 33 | - Microsoft SQL Server 2022 34 | 35 | ### Supported Client Versions 36 | 37 | - Microsoft SQL Server 2012 38 | 39 | ### Chef 40 | 41 | - Chef 15.3+ 42 | 43 | ## Resources 44 | 45 | - [sql_server_install](documentation/sql_server_install.md) 46 | - [sql_server_configure](documentation/sql_server_configure.md) 47 | 48 | ## Installing SQL Server remotely 49 | 50 | SQL Server does not support remote installation over WinRM. For example, the installation fails when you run `knife bootstrap windows winrm` or `knife winrm 'chef-client'` with a run-list that includes `server.rb`. However, you can use a scheduled task or run `chef-client` as a service. 51 | 52 | ## Contributors 53 | 54 | This project exists thanks to all the people who 55 | [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890&button=false) 56 | 57 | ### Backers 58 | 59 | Thank you to all our backers! 60 | 61 | ![https://opencollective.com/sous-chefs#backers](https://opencollective.com/sous-chefs/backers.svg?width=600&avatarHeight=40) 62 | 63 | ### Sponsors 64 | 65 | Support this project by becoming a sponsor. Your logo will show up here with a link to your website. 66 | 67 | ![https://opencollective.com/sous-chefs/sponsor/0/website](https://opencollective.com/sous-chefs/sponsor/0/avatar.svg?avatarHeight=100) 68 | ![https://opencollective.com/sous-chefs/sponsor/1/website](https://opencollective.com/sous-chefs/sponsor/1/avatar.svg?avatarHeight=100) 69 | ![https://opencollective.com/sous-chefs/sponsor/2/website](https://opencollective.com/sous-chefs/sponsor/2/avatar.svg?avatarHeight=100) 70 | ![https://opencollective.com/sous-chefs/sponsor/3/website](https://opencollective.com/sous-chefs/sponsor/3/avatar.svg?avatarHeight=100) 71 | ![https://opencollective.com/sous-chefs/sponsor/4/website](https://opencollective.com/sous-chefs/sponsor/4/avatar.svg?avatarHeight=100) 72 | ![https://opencollective.com/sous-chefs/sponsor/5/website](https://opencollective.com/sous-chefs/sponsor/5/avatar.svg?avatarHeight=100) 73 | ![https://opencollective.com/sous-chefs/sponsor/6/website](https://opencollective.com/sous-chefs/sponsor/6/avatar.svg?avatarHeight=100) 74 | ![https://opencollective.com/sous-chefs/sponsor/7/website](https://opencollective.com/sous-chefs/sponsor/7/avatar.svg?avatarHeight=100) 75 | ![https://opencollective.com/sous-chefs/sponsor/8/website](https://opencollective.com/sous-chefs/sponsor/8/avatar.svg?avatarHeight=100) 76 | ![https://opencollective.com/sous-chefs/sponsor/9/website](https://opencollective.com/sous-chefs/sponsor/9/avatar.svg?avatarHeight=100) 77 | -------------------------------------------------------------------------------- /TESTING.md: -------------------------------------------------------------------------------- 1 | # Testing 2 | 3 | Please refer to [the community cookbook documentation on testing](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/main/TESTING.MD). 4 | -------------------------------------------------------------------------------- /chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # to a Chef Infra Server or Supermarket. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | ehthumbs.db 9 | Icon? 10 | nohup.out 11 | Thumbs.db 12 | .envrc 13 | 14 | # EDITORS # 15 | ########### 16 | .#* 17 | .project 18 | .settings 19 | *_flymake 20 | *_flymake.* 21 | *.bak 22 | *.sw[a-z] 23 | *.tmproj 24 | *~ 25 | \#* 26 | REVISION 27 | TAGS* 28 | tmtags 29 | .vscode 30 | .editorconfig 31 | 32 | ## COMPILED ## 33 | ############## 34 | *.class 35 | *.com 36 | *.dll 37 | *.exe 38 | *.o 39 | *.pyc 40 | *.so 41 | */rdoc/ 42 | a.out 43 | mkmf.log 44 | 45 | # Testing # 46 | ########### 47 | .circleci/* 48 | .codeclimate.yml 49 | .delivery/* 50 | .foodcritic 51 | .kitchen* 52 | .mdlrc 53 | .overcommit.yml 54 | .rspec 55 | .rubocop.yml 56 | .travis.yml 57 | .watchr 58 | .yamllint 59 | azure-pipelines.yml 60 | Dangerfile 61 | examples/* 62 | features/* 63 | Guardfile 64 | kitchen*.yml 65 | mlc_config.json 66 | Procfile 67 | Rakefile 68 | spec/* 69 | test/* 70 | 71 | # SCM # 72 | ####### 73 | .git 74 | .gitattributes 75 | .gitconfig 76 | .github/* 77 | .gitignore 78 | .gitkeep 79 | .gitmodules 80 | .svn 81 | */.bzr/* 82 | */.git 83 | */.hg/* 84 | */.svn/* 85 | 86 | # Berkshelf # 87 | ############# 88 | Berksfile 89 | Berksfile.lock 90 | cookbooks/* 91 | tmp 92 | 93 | # Bundler # 94 | ########### 95 | vendor/* 96 | Gemfile 97 | Gemfile.lock 98 | 99 | # Policyfile # 100 | ############## 101 | Policyfile.rb 102 | Policyfile.lock.json 103 | 104 | # Documentation # 105 | ############# 106 | CODE_OF_CONDUCT* 107 | CONTRIBUTING* 108 | documentation/* 109 | TESTING* 110 | UPGRADING* 111 | 112 | # Vagrant # 113 | ########### 114 | .vagrant 115 | Vagrantfile 116 | -------------------------------------------------------------------------------- /documentation/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sous-chefs/sql_server/3e237e7acf78dae6c0ff46b25dfacbdbb4516156/documentation/.gitkeep -------------------------------------------------------------------------------- /documentation/sql_server_configure.md: -------------------------------------------------------------------------------- 1 | # sql_server_configure 2 | 3 | ## Actions 4 | 5 | - `:service` - Configures the ports that SQL be listening on and starts and enables the SQL Service. 6 | 7 | ## Properties 8 | 9 | - `version` - SQL Version of the instance to be configured. Valid options are `2012`, `2016`, `2017`, `2019`, `2022`. Default is `2012` 10 | - `tcp_enabled` - If TCP is enabled for the instance. Default is true 11 | - `sql_port` - Port SQL will listen on. Default is 1433 12 | - `tcp_dynamic_ports` - Sets the Dynamic port SQL will listen on. Default is an empty string 13 | - `np_enabled` - Whether named pipes is enabled. Default is false 14 | - `sm_enabled` - Whether shared memory is enabled for the instance 15 | - `via_default_port` - Configures the Virtual Interface Adapter default port. Default is `0:1433` 16 | - `via_enabled` - Whether Virtual Interface Adapter is enabled. Default is false 17 | - `via_listen_info` - Configures the Virtual interface listening information. Default is `0:1433` 18 | - `agent_startup` - Configures the SQL Agent Service startup type. Valid options are `Automatic`, `Manual`, `Disabled`, or `Automatic (Delayed Start)`. Default is `Disabled` 19 | 20 | ## Examples 21 | 22 | Configure a SQL 2012 Express install with all the defaults 23 | 24 | ```ruby 25 | sql_server_configure 'SQLEXPRESS' 26 | ``` 27 | 28 | Configure a SQL 2016 Express install 29 | 30 | ```ruby 31 | sql_server_configure 'SQLEXPRESS' do 32 | version '2016' 33 | end 34 | ``` 35 | 36 | Configure a SQL 2019 Express install 37 | 38 | ```ruby 39 | sql_server_configure 'SQLEXPRESS' do 40 | version '2019' 41 | end 42 | ``` 43 | 44 | Configure a SQL 2012 Evaluation install with a different port 45 | 46 | ```ruby 47 | sql_server_configure 'MSSQLSERVER' do 48 | version '2012' 49 | sql_port '1434' 50 | end 51 | ``` 52 | -------------------------------------------------------------------------------- /documentation/sql_server_install.md: -------------------------------------------------------------------------------- 1 | # sql_server_install 2 | 3 | ## Actions 4 | 5 | - `:install` - Installs the version of Microsoft SQL server specified. Default install is SQL 2012 Express. 6 | 7 | ## Properties 8 | 9 | - `feature` - An Array of the SQL Instance or Server features that are going to be enabled / installed. 10 | 11 | ### [SQL 2012 Available Features list](https://technet.microsoft.com/library/cc645993(SQL.110).aspx) 12 | 13 | ### Instance Features 14 | 15 | - `SQLENGINE` = Database Engine 16 | - `REPLICATION` = Replication 17 | - `FULLTEXT` = Full-Text and Semantic Extractions for search 18 | - `DQ` = Data Quality Services 19 | - `AS` = Analysis Services 20 | - `RS` = Reporting Services - Native 21 | 22 | ### Shared Features 23 | 24 | - `RS_SHP` = Reporting Services - SharePoint 25 | - `RS_SHPWFE` = Reporting Services Add-in for SharePoint Products 26 | - `DQC` = Data Quality Client 27 | - `BIDS` = SQL Server data tools 28 | - `CONN` = Client tools connectivity 29 | - `IS` = Integration Services 30 | - `BC` = Client tools backwards compatibility 31 | - `SDK` = Client tools SDK 32 | - `BOL` = Documentation components 33 | - `SSMS` = Management tools 34 | - `SSMS_ADV` = Management tools - Advanced 35 | - `DREPLAY_CTLR` = Distributed replay controller 36 | - `DREPLAY_CLT` = Distributed replay client 37 | - `SNAC_SDK` = SQL client connectivity SDK 38 | 39 | ### [SQL 2016 Available Features list](https://technet.microsoft.com/library/cc645993(SQL.130).aspx) 40 | 41 | - Instance Features 42 | - `ADVANCEDANALYTICS` = R Services (In-Database) 43 | - `POLYBASE` = PolyBase Query Service for External Data 44 | Note: This Feature Requires Java Runtime Environment greater than 7 update 51. Only the standalone Polybase-enabled Instance is currently support by this cookbook. 45 | - Shared Features 46 | - `SQL_SHARED_MR` = R Server (Standalone) 47 | - `MDS` = Master Data Services 48 | - REMOVED for standalone install 49 | - `SSMS` = Management tools 50 | - `SSMS_ADV` = Management tools - Advanced 51 | 52 | ### [SQL 2017 Available Features list](https://docs.microsoft.com/en-us/sql/sql-server/editions-and-components-of-sql-server-2017) 53 | 54 | - Instance Features 55 | - `ADVANCEDANALYTICS` = Machine Learning services (In-Database) 56 | - `SQL_INST_MPY` = Machine Learning services (In-Database) with Python 57 | - `SQL_INST_MR` = Machine Learning services (In-Database) with R 58 | - Shared Features 59 | - `SQL_SHARED_AA` = Machine Learning Services (Standalone) 60 | - `SQL_SHARED_MR` = Machine Learning services (In-Database) with R 61 | - `SQL_SHARED_MPY` = Machine Learning services (In-Database) with Python 62 | - `IS` = Integrated Services 63 | - `IS_MASTER` - Scale Out Master 64 | - `IS_WORKER` - Scale Out Worker 65 | 66 | - `version` - Version of SQL to be installed. Valid otpions are `2012`, `2016`, or `2017`. Default is `2012` 67 | - `source_url` - Source of the SQL setup.exe install file. Default is built from the helper libraries. 68 | - `package_name` - Package name for the SQL install. If you specify a version this property is not necessary. Default is built from the helper libraries. 69 | - `package_checksum` - Package checksum in SHA256 format for the setup.exe file. Default is built from the helper libraries. 70 | - `sql_reboot` - Determines whether the node will be rebooted after the SQL Server installation. Default setting is true 71 | - `security_mode` - The Autentication mode for SQL. Valid options are `Windows Athentication` or `Mixed Mode Authentication`. Default value is `Windows Authentication` 72 | - `sa_password` - The SQL Administrator password when `Mixed Mode Authentication` is being used. SQL enforces a strong passwords for this value. 73 | - `sysadmins` - The list of Systems Administrators who can access the SQL Instance. This can either be a String or an Array. 74 | - `agent_account` - The Service Account that will be used to run the SQL Agent Service. Default is `NT AUTHORITY\SYSTEM`. 75 | - `agent_startup` - The Agent Service startup type. Valid options are `Automatic`, `Manual`, `Disabled`, or `Automatic (Delayed Start)`. Default is `Disabled`. 76 | - `agent_account_pwd` - Agent Service Account password. 77 | - `sql_account` - Service Account used to run the SQL service. Default is `NT AUTHORITY\NETWORK SERVICE` 78 | - `sql_account_pwd` - Service Account password for the SQL service account. 79 | - `browser_startup` - Service startup type for the SQL Browser Service. Valid options are `Automatic`, `Manual`, `Disabled`, or `Automatic (Delayed Start)`. Default is `Disabled`. 80 | - `installer_timeout` - Time out for the SQL installation. Default is `1500` 81 | - `accept_eula` - Whether or not to accept the end user license agreement. Default is `false` 82 | Note: For SQL 2016 if this will also accept the license for using R if `ADVANCEDANALYTICS` or `SQL_SHARED_MR` is listed in the feature property array. 83 | - `product_key` - Product key for not Express or Evaluation versions. 84 | - `update_enabled` - Whether or not to download updates during install. Default is true. 85 | - `update_source` - The Source Location of Windows Update or WSUS. Default is `MU`. Example = `c:/path/to/update` 86 | - `instance_name` - Name for the instance to be installed. Default is `SQLEXPRESS`. For non-express installs that want the default install it should be set to `MSSQLSERVER`. 87 | - `install_dir` - Directory SQL binaries will be installed to. Default is `C:\Program Files\Microsoft SQL Server` 88 | - `instance_dir` - Directory the Instance will be stored. Default is `C:\Program Files\Microsoft SQL Server` 89 | - `sql_data_dir` - Directory for SQL data 90 | - `sql_backup_dir` - Directory for backups 91 | - `sql_instant_file_init` - Enable instant file initialization for SQL Server service account. Default is `false` 92 | - `sql_user_db_dir` - Directory for the user database 93 | - `sql_user_db_log_dir` - Directory for the user database logs 94 | - `sql_temp_db_dir` - Directory for the temporary database 95 | - `sql_temp_db_log_dir` - Directory for the temporary database logs 96 | - `sql_temp_db_file_count` - Number of TempDB data files. Default is 8 or number of cores, whichever is lower. 97 | - `sql_temp_db_file_size` - Initial size of each TempDB data file in MB. Default is 8. 98 | - `sql_temp_db_file_growth` - Automatic growth increment for each TempDB data file in MB. Default is 64. 99 | - `sql_temp_db_log_file_size` - Initial size of the TempDB log file in MB. Default is 8. 100 | - `sql_temp_db_log_file_growth` - Automatic growth increment for the TempDB log file in MB. Default is 64. 101 | - `filestream_level` - Level to enable the filestream feature, Valid values are 0, 1, 2 or 3. Default is 0 102 | - `filestream_share_name` - Share name for the filestream feature. Default is `MSSQLSERVER` 103 | - `sql_collation` - SQL Collation type for the instance 104 | - `netfx35_install` - If the .Net 3.5 Windows Feature is installed. This is required to successfully install SQL 2012. Default is true. 105 | - `netfx35_source` - Source location for the .Net 3.5 Windows Features install. Only required for offline installs 106 | 107 | ### Distributed Replay 108 | 109 | - `dreplay_ctlr_admins` - List of admins for the Distributed Replay Controller. Default is `Administrator`. The `DREPLAY_CTLR` feature needs to be included in the feature Array for this property to work. 110 | - `dreplay_client_name` - Host name of the Distributed Replay Controller that the Client will point to. If the `DREPLAY_CLT` is in the feature list this property needs to be set. 111 | 112 | ### Reporting Services 113 | 114 | - `rs_account` - Service Account name used to run SQL Reporting Services. To have reporting services it needs to be listed in the `feature` property array. 115 | - `rs_account_pwd` - Service Account password for the Reporting Services Service 116 | - `rs_startup` - Reporting Services service startup type. Valid options are `Automatic`, `Manual`, `Disabled`, or `Automatic (Delayed Start)`. Default is `Automatic`. 117 | - `rs_mode` - Mode the Reporting Services is installed in. Default is `FilesOnlyMode` 118 | 119 | ### Analysis Services 120 | 121 | - `as_sysadmins` - Analysis Services Systems Administrator list. Default is `Administrator` 122 | - `as_svc_account` - Service Account used by Analysis Services. Default is `NT Service\MSSQLServerOLAPService` 123 | 124 | ### PolyBase Query Services 125 | 126 | - `polybase_port_range` - Port Range for the PolyBase Query Service. Default is `16450-16460`. 127 | 128 | ### Integrated Services 129 | 130 | - `is_master_port` - Port for the Integrated Services Scale out Master. Default is 8391. 131 | - `is_master_ssl_cert` - The CNs in the certificate used to protect communications between the integration services scale out worker and scale out master. 132 | - `is_master_cert_thumbprint` - The certificate thumbprint for the scale out master ssl certificate. 133 | - `is_worker_master_url` - The url of the scale out master when installing a scale out worker. 134 | 135 | ## Examples 136 | 137 | Install SQL 2012 Express with all the defaults 138 | 139 | ```ruby 140 | sql_server_install 'Install SQL 2012 Express' 141 | ``` 142 | 143 | Install SQL 2016 Express 144 | 145 | ```ruby 146 | sql_server_install 'Install SQL 2016 Express' do 147 | version '2016' 148 | end 149 | ``` 150 | 151 | Install SQL 2012 Evaluation from a local source with default instance name, Integrated Services, Reporting Services, and the SQL Management Tools. 152 | 153 | ```ruby 154 | sql_server_install 'Install SQL Server 2012 Evaluation' do 155 | source_url 'C:\\Sources\\SQL 2012 Eval\\setup.exe' 156 | version '2012' 157 | package_checksum '0FE903...420E8F' 158 | accept_eula true 159 | instance_name 'MSSQLSERVER' 160 | feature %w(SQLENGINE IS RS SSMS ADV_SSMS) 161 | end 162 | ``` 163 | -------------------------------------------------------------------------------- /kitchen.dokken.yml: -------------------------------------------------------------------------------- 1 | driver: 2 | name: dokken 3 | privileged: true 4 | chef_version: <%= ENV['CHEF_VERSION'] || 'current' %> 5 | 6 | transport: { name: dokken } 7 | provisioner: { name: dokken } 8 | 9 | platforms: 10 | - name: almalinux-8 11 | driver: 12 | image: dokken/almalinux-8 13 | pid_one_command: /usr/lib/systemd/systemd 14 | 15 | - name: almalinux-9 16 | driver: 17 | image: dokken/almalinux-9 18 | pid_one_command: /usr/lib/systemd/systemd 19 | 20 | - name: almalinux-10 21 | driver: 22 | image: dokken/almalinux-10 23 | pid_one_command: /usr/lib/systemd/systemd 24 | 25 | - name: amazonlinux-2023 26 | driver: 27 | image: dokken/amazonlinux-2023 28 | pid_one_command: /usr/lib/systemd/systemd 29 | 30 | - name: centos-stream-9 31 | driver: 32 | image: dokken/centos-stream-9 33 | pid_one_command: /usr/lib/systemd/systemd 34 | 35 | - name: centos-stream-10 36 | driver: 37 | image: dokken/centos-stream-10 38 | pid_one_command: /usr/lib/systemd/systemd 39 | 40 | - name: debian-11 41 | driver: 42 | image: dokken/debian-11 43 | pid_one_command: /bin/systemd 44 | 45 | - name: debian-12 46 | driver: 47 | image: dokken/debian-12 48 | pid_one_command: /bin/systemd 49 | 50 | - name: fedora-latest 51 | driver: 52 | image: dokken/fedora-latest 53 | pid_one_command: /usr/lib/systemd/systemd 54 | 55 | - name: opensuse-leap-15 56 | driver: 57 | image: dokken/opensuse-leap-15 58 | pid_one_command: /usr/lib/systemd/systemd 59 | 60 | - name: oraclelinux-8 61 | driver: 62 | image: dokken/oraclelinux-8 63 | pid_one_command: /usr/lib/systemd/systemd 64 | 65 | - name: oraclelinux-9 66 | driver: 67 | image: dokken/oraclelinux-9 68 | pid_one_command: /usr/lib/systemd/systemd 69 | 70 | - name: rockylinux-8 71 | driver: 72 | image: dokken/rockylinux-8 73 | pid_one_command: /usr/lib/systemd/systemd 74 | 75 | - name: rockylinux-9 76 | driver: 77 | image: dokken/rockylinux-9 78 | pid_one_command: /usr/lib/systemd/systemd 79 | 80 | - name: ubuntu-20.04 81 | driver: 82 | image: dokken/ubuntu-20.04 83 | pid_one_command: /bin/systemd 84 | 85 | - name: ubuntu-22.04 86 | driver: 87 | image: dokken/ubuntu-22.04 88 | pid_one_command: /bin/systemd 89 | 90 | - name: ubuntu-24.04 91 | driver: 92 | image: dokken/ubuntu-24.04 93 | pid_one_command: /bin/systemd 94 | -------------------------------------------------------------------------------- /kitchen.exec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver: { name: exec } 3 | transport: { name: exec } 4 | 5 | platforms: 6 | - name: macos-latest 7 | - name: windows-latest 8 | -------------------------------------------------------------------------------- /kitchen.global.yml: -------------------------------------------------------------------------------- 1 | --- 2 | provisioner: 3 | name: chef_infra 4 | product_name: chef 5 | product_version: <%= ENV['CHEF_VERSION'] || 'latest' %> 6 | channel: stable 7 | install_strategy: once 8 | chef_license: accept 9 | enforce_idempotency: <%= ENV['ENFORCE_IDEMPOTENCY'] || true %> 10 | multiple_converge: <%= ENV['MULTIPLE_CONVERGE'] || 2 %> 11 | deprecations_as_errors: true 12 | log_level: <%= ENV['CHEF_LOG_LEVEL'] || 'auto' %> 13 | 14 | verifier: 15 | name: inspec 16 | 17 | platforms: 18 | - name: almalinux-8 19 | - name: almalinux-9 20 | - name: amazonlinux-2023 21 | - name: centos-stream-9 22 | - name: debian-11 23 | - name: debian-12 24 | - name: fedora-latest 25 | - name: opensuse-leap-15 26 | - name: oraclelinux-8 27 | - name: oraclelinux-9 28 | - name: rockylinux-8 29 | - name: rockylinux-9 30 | - name: ubuntu-20.04 31 | - name: ubuntu-22.04 32 | - name: ubuntu-24.04 33 | -------------------------------------------------------------------------------- /kitchen.yml: -------------------------------------------------------------------------------- 1 | driver: 2 | name: vagrant 3 | gui: false 4 | customize: 5 | cpus: 2 6 | memory: 4096 7 | 8 | transport: 9 | name: winrm 10 | elevated: true 11 | 12 | provisioner: 13 | name: chef_zero 14 | product_name: <%= ENV['CHEF_PRODUCT_NAME'] || 'chef' %> 15 | deprecations_as_errors: true 16 | chef_license: accept-no-persist 17 | retry_on_exit_code: 18 | - 35 # 35 is the exit code signaling that the node is rebooting 19 | max_retries: 5 20 | wait_for_retry: 90 21 | 22 | verifier: 23 | name: inspec 24 | 25 | platforms: 26 | - name: windows-2019 27 | driver: 28 | box: tas50/windows_2019 29 | 30 | suites: 31 | - name: default 32 | run_list: 33 | - recipe[test::default] 34 | 35 | - name: client 36 | run_list: 37 | - recipe[sql_server::default] 38 | attributes: {sql_server: {accept_eula: true}} 39 | verifier: 40 | controls: 41 | - client 42 | - name: server2012 43 | run_list: 44 | - recipe[sql_server::server] 45 | attributes: {sql_server: {accept_eula: true, version: 2012, server_sa_password: Supersecurepassword123}} 46 | verifier: 47 | controls: 48 | - server 49 | inputs: 50 | version: 2012 51 | - name: server2016 52 | run_list: 53 | - recipe[sql_server::server] 54 | attributes: {sql_server: {accept_eula: true, version: 2016, server_sa_password: Supersecurepassword123}} 55 | verifier: 56 | controls: 57 | - server 58 | inputs: 59 | version: 2016 60 | - name: server2017 61 | run_list: 62 | - recipe[sql_server::server] 63 | attributes: {sql_server: {accept_eula: true, version: 2017, server_sa_password: Supersecurepassword123}} 64 | verifier: 65 | controls: 66 | - server 67 | inputs: 68 | version: 2017 69 | - name: server2019 70 | run_list: 71 | - recipe[sql_server::server] 72 | attributes: {sql_server: {accept_eula: true, version: 2019, server_sa_password: Supersecurepassword123}} 73 | verifier: 74 | controls: 75 | - server 76 | inputs: 77 | version: 2019 78 | includes: 79 | - windows-2016 80 | - windows-2019 81 | - name: install 82 | run_list: 83 | - recipe[test::install] 84 | verifier: 85 | controls: 86 | - server 87 | inputs: 88 | version: 2012 89 | attributes: {sql_server: {accept_eula: true, version: 2012, server_sa_password: Supersecurepassword123}} 90 | -------------------------------------------------------------------------------- /libraries/helper.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Seth Chisamore () 3 | # Cookbook:: sql_server 4 | # Library:: helper 5 | # 6 | # Copyright:: 2011-2019, Chef Software, Inc. 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | require 'chef/mixin/shell_out' 21 | require 'chef/util/path_helper' 22 | 23 | module SqlServer 24 | module Helper 25 | extend Chef::Mixin::ShellOut 26 | 27 | def self.reg_version_string(version) 28 | case version.to_s # to_s to make sure someone didn't pass us an int 29 | when '2012' then 'MSSQL11.' 30 | when '2016' then 'MSSQL13.' 31 | when '2017' then 'MSSQL14.' 32 | when '2019' then 'MSSQL15.' 33 | when '2022' then 'MSSQL16.' 34 | else raise "Unsupported sql_server version '#{version}'. Please open a PR to add support for this version." 35 | end 36 | end 37 | 38 | def self.install_dir_version(version) 39 | case version.to_s # to_s to make sure someone didn't pass us an int 40 | when '2012' then '110' 41 | when '2016' then '130' 42 | when '2017' then '140' 43 | when '2019' then '150' 44 | when '2022' then '160' 45 | else raise "SQL Server version #{version} not supported. Please open a PR to add support for this version." 46 | end 47 | end 48 | 49 | def self.firewall_rule_enabled?(rule_name = nil) 50 | cmd = shell_out("netsh advfirewall firewall show rule \"#{rule_name}\"") 51 | cmd.stderr.empty? && (cmd.stdout =~ /Enabled:\s*Yes/i) 52 | end 53 | 54 | def self.sql_server_url(version, x86_64) 55 | if x86_64 56 | case version.to_s # to_s to make sure someone didn't pass us an int 57 | when '2012' then 'https://download.microsoft.com/download/8/D/D/8DD7BDBA-CEF7-4D8E-8C16-D9F69527F909/ENU/x64/SQLEXPR_x64_ENU.exe' 58 | when '2016' then 'https://download.microsoft.com/download/9/0/7/907AD35F-9F9C-43A5-9789-52470555DB90/ENU/SQLEXPR_x64_ENU.exe' 59 | when '2017' then 'https://download.microsoft.com/download/E/F/2/EF23C21D-7860-4F05-88CE-39AA114B014B/SQLEXPR_x64_ENU.exe' 60 | when '2019' then 'https://download.microsoft.com/download/7/c/1/7c14e92e-bdcb-4f89-b7cf-93543e7112d1/SQLEXPR_x64_ENU.exe' 61 | when '2022' then 'https://download.microsoft.com/download/5/1/4/5145fe04-4d30-4b85-b0d1-39533663a2f1/SQL2022-SSEI-Expr.exe' 62 | end 63 | else 64 | case version.to_s 65 | when '2012' then 'https://download.microsoft.com/download/8/D/D/8DD7BDBA-CEF7-4D8E-8C16-D9F69527F909/ENU/x86/SQLEXPR_x86_ENU.exe' 66 | end 67 | end 68 | end 69 | 70 | def self.sql_server_package_name(version, x86_64) 71 | if x86_64 72 | case version.to_s # to_s to make sure someone didn't pass us an int 73 | when '2012' then 'Microsoft SQL Server 2012 (64-bit)' 74 | when '2016' then 'Microsoft SQL Server 2016 (64-bit)' 75 | when '2017' then 'Microsoft SQL Server 2017 (64-bit)' 76 | when '2019' then 'Microsoft SQL Server 2019 (64-bit)' 77 | when '2022' then 'Microsoft SQL Server 2022 (64-bit)' 78 | end 79 | else 80 | case version.to_s 81 | when '2012' then 'Microsoft SQL Server 2012 (32-bit)' 82 | end 83 | end 84 | end 85 | 86 | def self.sql_server_checksum(version, x86_64) 87 | if x86_64 88 | case version.to_s # to_s to make sure someone didn't pass us an int 89 | when '2012' then '7f5e3d40b85fba2da5093e3621435c209c4ac90d34219bab8878e93a787cf29f' 90 | when '2016' then '2A5B64AE64A8285C024870EC4643617AC5146894DD59DD560E75CEA787BF9333' 91 | when '2017' then 'F857FF82145E196BF85AF32EEB0193FE38302E57B30BEB54E513630C60D83E0D' 92 | when '2019' then 'bea033e778048748eb1c87bf57597f7f5449b6a15bac55ddc08263c57f7a1ca8' 93 | when '2022' then '36e0ec2ac3dd60f496c99ce44722c629209ea7302a2ce9cbfd1e42a73510d7b6' 94 | end 95 | else 96 | case version.to_s 97 | when '2012' then '9bdd6a7be59c00b0201519b9075601b1c18ad32a3a166d788f3416b15206d6f5' 98 | end 99 | end 100 | end 101 | end 102 | end 103 | -------------------------------------------------------------------------------- /metadata.rb: -------------------------------------------------------------------------------- 1 | name 'sql_server' 2 | maintainer 'Sous Chefs' 3 | maintainer_email 'help@sous-chefs.org' 4 | license 'Apache-2.0' 5 | description 'Installs/Configures Microsoft SQL Server' 6 | version '8.0.4' 7 | source_url 'https://github.com/sous-chefs/sql_server' 8 | issues_url 'https://github.com/sous-chefs/sql_server/issues' 9 | chef_version '>= 15.3' 10 | 11 | supports 'windows' 12 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": ["config:base"], 4 | "packageRules": [ 5 | { 6 | "groupName": "Actions", 7 | "matchUpdateTypes": ["minor", "patch", "pin"], 8 | "automerge": true, 9 | "addLabels": ["Release: Patch", "Skip: Announcements"] 10 | }, 11 | { 12 | "groupName": "Actions", 13 | "matchUpdateTypes": ["major"], 14 | "automerge": false, 15 | "addLabels": ["Release: Patch", "Skip: Announcements"] 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /resources/client_install.rb: -------------------------------------------------------------------------------- 1 | unified_mode true 2 | 3 | property :native_client, 4 | Hash, 5 | default: { 6 | url: 'http://download.microsoft.com/download/F/E/D/FEDB200F-DE2A-46D8-B661-D019DFE9D470/ENU/x64/sqlncli.msi', 7 | checksum: '5601a1969d12a72a16e3659712bc9727b3fd874b5f6f802fd1e042cac75cc069', 8 | package_name: 'Microsoft SQL Server 2012 Native Client', 9 | } 10 | 11 | property :command_line_utils, 12 | Hash, 13 | default: { 14 | url: 'http://download.microsoft.com/download/F/E/D/FEDB200F-DE2A-46D8-B661-D019DFE9D470/ENU/x64/SqlCmdLnUtils.msi', 15 | checksum: '3f5cb4b876421286f8fd9666f00345a95d8ce1b6229baa6aeb2f076ef9e4aefe', 16 | package_name: 'Microsoft SQL Server 2012 Command Line Utilities', 17 | } 18 | 19 | property :clr_types, 20 | Hash, 21 | default: { 22 | url: 'http://download.microsoft.com/download/F/E/D/FEDB200F-DE2A-46D8-B661-D019DFE9D470/ENU/x64/SQLSysClrTypes.msi', 23 | checksum: '4b2f86c3f001d6a13db25bf993f8144430db04bde43853b9f2e359aa4bd491d0', 24 | package_name: 'Microsoft SQL Server System CLR Types (x64)', 25 | } 26 | 27 | property :smo, 28 | Hash, 29 | default: { 30 | url: 'http://download.microsoft.com/download/F/E/D/FEDB200F-DE2A-46D8-B661-D019DFE9D470/ENU/x64/SharedManagementObjects.msi', 31 | checksum: '36d174cd87d5fc432beb4861863d8a7f944b812032727a6e7074a1fcab950faa', 32 | package_name: 'Microsoft SQL Server 2012 Management Objects (x64)', 33 | } 34 | 35 | property :ps_extensions, 36 | Hash, 37 | default: { 38 | url: 'http://download.microsoft.com/download/F/E/D/FEDB200F-DE2A-46D8-B661-D019DFE9D470/ENU/x64/PowerShellTools.MSI', 39 | checksum: 'bb33e64659f7500d7f2088e3d5e7ac34a1bf13988736b8ba0075741fce1e67b6', 40 | package_name: 'Windows PowerShell Extensions for SQL Server 2012', 41 | } 42 | 43 | property :accept_eula, [true, false], default: false 44 | 45 | action :install do 46 | %w( native_client command_line_utils clr_types smo ps_extensions ).each do |_pkg| 47 | package new_resource.pkg do 48 | source new_resource.pkg[:source] 49 | url new_resource.pkg[:url] 50 | checksum new_resource.pkg[:checksum] 51 | installer_type :msi 52 | options "IACCEPTSQLNCLILICENSETERMS=#{new_resource.accept_eula ? 'YES' : 'NO'}" 53 | action :install 54 | end 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /resources/configure.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: sql_server 3 | # Resource:: configure 4 | # 5 | # Copyright:: 2017-2019, Chef Software, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | unified_mode true 20 | 21 | property :reg_version, String 22 | property :version, [Integer, String], default: '2012' 23 | property :tcp_enabled, [true, false], default: true 24 | property :sql_port, Integer, default: 1433 25 | property :tcp_dynamic_ports, String, default: '' 26 | property :np_enabled, [true, false], default: false 27 | property :sm_enabled, [true, false], default: true 28 | property :via_default_port, String, default: '0:1433' 29 | property :via_enabled, [true, false], default: false 30 | property :via_listen_info, String, default: '0:1433' 31 | property :agent_startup, String, equal_to: ['Automatic', 'Manual', 'Disabled', 'Automatic (Delayed Start)'], default: 'Disabled' 32 | 33 | action :service do 34 | # Compute registry version based on sql server version 35 | reg_version = new_resource.reg_version || ::SqlServer::Helper.reg_version_string(new_resource.version) 36 | 37 | reg_prefix = "HKLM\\SOFTWARE\\Microsoft\\Microsoft SQL Server\\#{reg_version}#{new_resource.name}\\MSSQLServer" 38 | 39 | # Configure Tcp settings - static tcp ports 40 | registry_key "#{reg_prefix}\\SuperSocketNetLib\\Tcp\\IPAll" do 41 | values [{ name: 'Enabled', type: :dword, data: new_resource.tcp_enabled ? 1 : 0 }, 42 | { name: 'TcpPort', type: :string, data: new_resource.sql_port.to_s }, 43 | { name: 'TcpDynamicPorts', type: :string, data: new_resource.tcp_dynamic_ports.to_s }] 44 | recursive true 45 | notifies :restart, "service[#{service_name}]", :delayed 46 | end 47 | 48 | # Configure Named Pipes settings 49 | registry_key "#{reg_prefix}\\SuperSocketNetLib\\Np" do 50 | values [{ name: 'Enabled', type: :dword, data: new_resource.np_enabled ? 1 : 0 }] 51 | recursive true 52 | notifies :restart, "service[#{service_name}]", :delayed 53 | end 54 | 55 | # Configure Shared Memory settings 56 | registry_key "#{reg_prefix}\\SuperSocketNetLib\\Sm" do 57 | values [{ name: 'Enabled', type: :dword, data: new_resource.sm_enabled ? 1 : 0 }] 58 | recursive true 59 | notifies :restart, "service[#{service_name}]", :delayed 60 | end 61 | 62 | # Configure Via settings 63 | registry_key "#{reg_prefix}\\SuperSocketNetLib\\Via" do 64 | values [{ name: 'DefaultServerPort', type: :string, data: new_resource.via_default_port.to_s }, 65 | { name: 'Enabled', type: :dword, data: new_resource.via_enabled ? 1 : 0 }, 66 | { name: 'ListenInfo', type: :string, data: new_resource.via_listen_info.to_s }] 67 | recursive true 68 | notifies :restart, "service[#{service_name}]", :delayed 69 | end 70 | 71 | # If you have declared an agent account it will restart both the 72 | # agent service and the sql service. If not only the sql service 73 | if new_resource.agent_startup == 'Automatic' 74 | service agent_service_name do 75 | action [:start, :enable] 76 | end 77 | end 78 | 79 | service service_name do 80 | action [:start, :enable] 81 | restart_command %(powershell.exe -C "restart-service '#{service_name}' -force") 82 | end 83 | end 84 | 85 | action_class do 86 | include ::SqlServer::Helper 87 | 88 | def service_name 89 | (new_resource.name != 'MSSQLSERVER') ? "MSSQL$#{new_resource.name}" : new_resource.name 90 | end 91 | 92 | def agent_service_name 93 | (new_resource.name == 'MSSQLSERVER') ? 'SQLSERVERAGENT' : "SQLAgent$#{new_resource.name}" 94 | end 95 | end 96 | -------------------------------------------------------------------------------- /resources/install.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: sql_server 3 | # Resource:: install 4 | # 5 | # Copyright:: 2017-2019, Chef Software, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | unified_mode true 20 | 21 | property :sql_reboot, [true, false], default: true 22 | property :security_mode, String, equal_to: ['Windows Authentication', 'Mixed Mode Authentication'], default: 'Windows Authentication' 23 | property :sa_password, String 24 | property :sysadmins, [Array, String], default: ['Administrator'] 25 | property :agent_account, String, default: 'NT AUTHORITY\NETWORK SERVICE' 26 | property :agent_startup, String, equal_to: ['Automatic', 'Manual', 'Disabled', 'Automatic (Delayed Start)'], default: 'Disabled' 27 | property :agent_account_pwd, String 28 | property :rs_account, String, default: 'NT AUTHORITY\NETWORK SERVICE' 29 | property :rs_account_pwd, String 30 | property :rs_startup, String, equal_to: ['Automatic', 'Manual', 'Disabled', 'Automatic (Delayed Start)'], default: 'Automatic' 31 | property :rs_mode, String, default: 'FilesOnlyMode' 32 | property :as_sysadmins, [Array, String], default: ['Administrator'] 33 | property :sql_account, String, default: 'NT AUTHORITY\NETWORK SERVICE' 34 | property :sql_account_pwd, String 35 | property :browser_startup, String, equal_to: ['Automatic', 'Manual', 'Disabled', 'Automatic (Delayed Start)'], default: 'Disabled' 36 | property :version, [Integer, String], default: '2022' 37 | property :source_url, String 38 | property :package_name, String 39 | property :package_checksum, String 40 | property :installer_timeout, Integer, default: 1500 41 | property :accept_eula, [true, false], default: false 42 | property :product_key, String 43 | property :update_enabled, [true, false], default: true 44 | property :update_source, String, default: 'MU' 45 | property :instance_name, String, default: 'SQLEXPRESS' 46 | property :feature, [Array, String], default: %w(SQLENGINE REPLICATION) 47 | property :install_dir, String, default: 'C:\Program Files\Microsoft SQL Server' 48 | property :instance_dir, String, default: 'C:\Program Files\Microsoft SQL Server' 49 | property :shared_wow_dir, String, default: lazy { install_dir.gsub(/Program Files/, 'Program Files (x86)') } 50 | property :sql_data_dir, String 51 | property :sql_backup_dir, String 52 | property :sql_instant_file_init, [true, false], default: false 53 | property :sql_user_db_dir, String 54 | property :sql_user_db_log_dir, String 55 | property :sql_temp_db_dir, String 56 | property :sql_temp_db_log_dir, String 57 | property :sql_temp_db_file_count, Integer 58 | property :sql_temp_db_file_size, Integer 59 | property :sql_temp_db_file_growth, Integer 60 | property :sql_temp_db_log_file_size, Integer 61 | property :sql_temp_db_log_file_growth, Integer 62 | property :filestream_level, Integer, equal_to: [0, 1, 2, 3], default: 0 63 | property :filestream_share_name, String, default: 'MSSQLSERVER' 64 | property :sql_collation, String 65 | property :dreplay_ctlr_admins, [Array, String], default: ['Administrator'] 66 | property :dreplay_client_name, String 67 | property :netfx35_install, [true, false], default: false 68 | property :netfx35_source, String 69 | property :polybase_port_range, String, default: '16450-16460' 70 | property :is_master_port, String, default: '8391' 71 | property :is_master_ssl_cert, String 72 | property :is_master_cert_thumbprint, String 73 | property :is_worker_master_url, String 74 | property :as_svc_account, String, default: 'NT Service\MSSQLServerOLAPService' 75 | 76 | action :install do 77 | if new_resource.feature.include?('DREPLAY_CLT') && new_resource.dreplay_client_name.nil? 78 | ::Chef::Application.fatal!('You cannot select include the DREPLAY_CLT feature with specifing a controller to target.') 79 | end 80 | 81 | if new_resource.security_mode == 'Mixed Mode Authentication' && new_resource.sa_password.nil? 82 | ::Chef::Application.fatal!('You cannot have set the security mode to "Mixed Mode Authenication" without specifying the sa_password property') 83 | end 84 | 85 | if new_resource.netfx35_install 86 | windows_feature ['NET-Framework-Features', 'NET-Framework-Core'] do 87 | action :install 88 | source new_resource.netfx35_source if new_resource.netfx35_source 89 | install_method :windows_feature_powershell 90 | end 91 | end 92 | 93 | config_file_path = ::File.join(Chef::Config[:file_cache_path], 'ConfigurationFile.ini') 94 | 95 | x86_64 = node['kernel']['machine'] =~ /x86_64/ 96 | 97 | sql_sys_admin_list = build_admin_list(new_resource.sysadmins) 98 | as_sys_admin_list = build_admin_list(new_resource.as_sysadmins) 99 | dreplay_ctlr_admin_list = build_admin_list(new_resource.dreplay_ctlr_admins) 100 | 101 | template config_file_path do 102 | source 'ConfigurationFile.ini.erb' 103 | cookbook 'sql_server' 104 | variables( 105 | sqlSysAdminList: sql_sys_admin_list, 106 | version: new_resource.version, 107 | accept_eula: new_resource.accept_eula, 108 | product_key: new_resource.product_key, 109 | sa_password: new_resource.sa_password, 110 | agent_account: new_resource.agent_account, 111 | agent_startup: new_resource.agent_startup, 112 | update_enabled: new_resource.update_enabled, 113 | update_source: new_resource.update_source, 114 | instance_name: new_resource.instance_name, 115 | feature_list: new_resource.feature, 116 | install_dir: new_resource.install_dir, 117 | shared_wow_dir: new_resource.shared_wow_dir, 118 | instance_dir: new_resource.instance_dir, 119 | sql_instant_file_init: new_resource.sql_instant_file_init, 120 | sql_data_dir: new_resource.sql_data_dir, 121 | sql_backup_dir: new_resource.sql_backup_dir, 122 | sql_user_db_dir: new_resource.sql_user_db_dir, 123 | sql_user_db_log_dir: new_resource.sql_user_db_log_dir, 124 | sql_temp_db_dir: new_resource.sql_temp_db_dir, 125 | sql_temp_db_log_dir: new_resource.sql_temp_db_log_dir, 126 | sql_temp_db_file_count: new_resource.sql_temp_db_file_count, 127 | sql_temp_db_file_size: new_resource.sql_temp_db_file_size, 128 | sql_temp_db_file_growth: new_resource.sql_temp_db_file_growth, 129 | sql_temp_db_log_file_size: new_resource.sql_temp_db_log_file_size, 130 | sql_temp_db_log_file_growth: new_resource.sql_temp_db_log_file_growth, 131 | filestream_level: new_resource.filestream_level, 132 | filestream_share_name: new_resource.filestream_share_name, 133 | sql_collation: new_resource.sql_collation, 134 | sql_account: new_resource.sql_account, 135 | browser_startup: new_resource.browser_startup, 136 | rs_account: new_resource.rs_account, 137 | rs_startup: new_resource.rs_startup, 138 | rs_mode: new_resource.rs_mode, 139 | asSysAdminList: as_sys_admin_list, 140 | dreplayCtlrList: dreplay_ctlr_admin_list, 141 | dreplay_client_name: new_resource.dreplay_client_name, 142 | security_mode: new_resource.security_mode, 143 | polybase_port_range: new_resource.polybase_port_range, 144 | is_master_port: new_resource.is_master_port, 145 | is_master_ssl_cert: new_resource.is_master_ssl_cert, 146 | is_master_cert_thumbprint: new_resource.is_master_cert_thumbprint, 147 | is_worker_master_url: new_resource.is_worker_master_url, 148 | as_svc_account: new_resource.as_svc_account 149 | ) 150 | sensitive true 151 | end 152 | 153 | package_url = new_resource.source_url || 154 | ::SqlServer::Helper.sql_server_url(new_resource.version, x86_64) || 155 | ::Chef::Application.fatal!("No package URL matches '#{new_resource.version}'. source_url property must be set or version property must match a supported version.") 156 | 157 | install_name = new_resource.package_name || 158 | ::SqlServer::Helper.sql_server_package_name(new_resource.version, x86_64) || 159 | ::Chef::Application.fatal!("No package name matches '#{new_resource.version}'. package_name property must be set or version property must match a supported version.") 160 | 161 | install_checksum = new_resource.package_checksum || 162 | ::SqlServer::Helper.sql_server_checksum(new_resource.version, x86_64) || 163 | ::Chef::Application.fatal!("No package checksum matches '#{new_resource.version}'. package_checksum property must be set or version property must match a supported version.") 164 | 165 | # Build safe password command line options for the installer 166 | # see http://technet.microsoft.com/library/ms144259 167 | passwords_options = { 168 | AGTSVCPASSWORD: new_resource.agent_account_pwd, 169 | RSSVCPASSWORD: new_resource.rs_account_pwd, 170 | SQLSVCPASSWORD: new_resource.sql_account_pwd, 171 | }.map do |option, attribute| 172 | next unless attribute 173 | # Escape password double quotes and backslashes 174 | safe_password = attribute.gsub(/["\\]/, '\\\\\0') 175 | # When the number of double quotes is odd, we need to escape the enclosing quotes 176 | enclosing_escape = safe_password.count('"').odd? ? '^' : '' 177 | "/#{option}=\"#{safe_password}#{enclosing_escape}\"" 178 | end.compact.join ' ' 179 | 180 | package install_name do 181 | source package_url 182 | checksum install_checksum 183 | timeout new_resource.installer_timeout 184 | installer_type :custom 185 | options "/q /ConfigurationFile=#{config_file_path} #{passwords_options}" 186 | action :install 187 | notifies :reboot_now, 'reboot[sql server install]' if new_resource.sql_reboot 188 | returns [0, 42, 127, 3010] 189 | end 190 | 191 | # SQL Server requires a reboot to complete your install 192 | reboot 'sql server install' do 193 | action :nothing 194 | reason 'Needs to reboot after installing SQL Server' 195 | delay_mins 1 196 | end 197 | end 198 | 199 | action_class do 200 | include ::SqlServer::Helper 201 | 202 | def build_admin_list(admin_list) 203 | if admin_list.is_a? Array 204 | admin_list.map { |account| %("#{account}") }.join(' ') 205 | else 206 | %("#{admin_list}") 207 | end 208 | end 209 | end 210 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'chefspec' 2 | require 'chefspec/berkshelf' 3 | 4 | RSpec.configure do |config| 5 | config.color = true # Use color in STDOUT 6 | config.formatter = :documentation # Use the specified formatter 7 | config.log_level = :error # Avoid deprecation notice SPAM 8 | end 9 | -------------------------------------------------------------------------------- /templates/ConfigurationFile.ini.erb: -------------------------------------------------------------------------------- 1 | ; SQLSERVER<%= @version %> Configuration File 2 | ; Generated by Chef for <%= node['fqdn'] %> 3 | [OPTIONS] 4 | 5 | ; Auto accept the license terms 6 | 7 | IACCEPTSQLSERVERLICENSETERMS="<%= @accept_eula ? "True" : "False" %>" 8 | 9 | <% unless (@product_key.nil? || @product_key.empty?) -%> 10 | ; Product Key 11 | 12 | PID="<%= @product_key %>" 13 | <% end -%> 14 | ; The default is Windows Authentication. Use "SQL" for Mixed Mode Authentication. 15 | 16 | <% unless @security_mode == 'Windows Authentication'%> 17 | SECURITYMODE="SQL" 18 | SAPWD="<%= @sa_password %>" 19 | <% end %> 20 | 21 | ; Specify whether SQL Server Setup should discover and include product updates. The valid values are True and False or 1 and 0. By default SQL Server Setup will include updates that are found. 22 | 23 | UpdateEnabled="<%= @update_enabled ? "True" : "False" %>" 24 | 25 | ; Specify the location where SQL Server Setup will obtain product updates. The valid values are "MU" to search Microsoft Update, a valid folder path, a relative path such as .\MyUpdates or a UNC share. By default SQL Server Setup will search Microsoft Update or a Windows Update service through the Window Server Update Services. 26 | 27 | UpdateSource= "<%= @update_source %>" 28 | 29 | ; Specify the Instance ID for the SQL Server features you have specified. SQL Server directory structure, registry structure, and service names will reflect the instance ID of the SQL Server instance. 30 | 31 | INSTANCEID="<%= @instance_name %>" 32 | 33 | ; Specifies a Setup work flow, like INSTALL, UNINSTALL, or UPGRADE. This is a required parameter. 34 | 35 | ACTION="Install" 36 | 37 | ; Specifies features to install, uninstall, or upgrade. The list of top-level features include SQL, AS, RS, IS, and Tools. The SQL feature will install the database engine, replication, and full-text. The Tools feature will install Management Tools, Books online, Business Intelligence Development Studio, and other shared components. 38 | 39 | <% if @feature_list.is_a? Array %> 40 | FEATURES=<%= %("#{@feature_list.join(',')}") %> 41 | <% else %> 42 | FEATURES=<%= %("#{@feature_list}") %> 43 | <% end %> 44 | 45 | ; Displays the command line parameters usage 46 | 47 | HELP="False" 48 | 49 | ; Specifies that the detailed Setup log should be piped to the console. 50 | 51 | INDICATEPROGRESS="False" 52 | 53 | ; Setup will not display any user interface. 54 | 55 | QUIET="False" 56 | 57 | ; Setup will display progress only without any user interaction. 58 | 59 | QUIETSIMPLE="False" 60 | 61 | <% if @version != '2022' %> 62 | ; Specifies that Setup should install into WOW64. This command line argument is not supported on an IA64 or a 32-bit system. 63 | 64 | X86="False" 65 | <% end%> 66 | 67 | ; Detailed help for command line argument ROLE has not been defined yet. 68 | 69 | ROLE="AllFeatures_WithDefaults" 70 | 71 | ; Detailed help for command line argument ENU has not been defined yet. 72 | 73 | ENU="True" 74 | 75 | ; Parameter that controls the user interface behavior. Valid values are Normal for the full UI, and AutoAdvance for a simplied UI. 76 | ; UIMode setting cannot be used in conjunction with /Q or /QS 77 | ; UIMODE="Normal" 78 | 79 | ; Specify if errors can be reported to Microsoft to improve future SQL Server releases. Specify 1 or True to enable and 0 or False to disable this feature. 80 | 81 | ERRORREPORTING="False" 82 | 83 | ; Specify the root installation directory for native shared components. 84 | 85 | INSTALLSHAREDDIR="<%= @install_dir %>" 86 | <% if node['kernel']['machine'] =~ /x86_64/ %> 87 | 88 | ; Specify the root installation directory for the WOW64 shared components. 89 | 90 | INSTALLSHAREDWOWDIR="<%= @shared_wow_dir %>" 91 | <% end %> 92 | 93 | ; Specify the installation directory. 94 | 95 | INSTANCEDIR="<%= @instance_dir %>" 96 | <% unless @sql_data_dir.nil? -%> 97 | 98 | ; The Database Engine root data directory. 99 | 100 | INSTALLSQLDATADIR="<%= @sql_data_dir %>" 101 | <% end -%> 102 | <% unless @sql_backup_dir.nil? -%> 103 | 104 | ; Default directory for SQL backup files. 105 | 106 | SQLBACKUPDIR="<%= @sql_backup_dir %>" 107 | <% end -%> 108 | <% unless @sql_user_db_dir.nil? -%> 109 | 110 | ; Default directory for the Database Engine user databases. 111 | 112 | SQLUSERDBDIR="<%= @sql_user_db_dir %>" 113 | <% end -%> 114 | <% unless @sql_user_db_log_dir.nil? -%> 115 | 116 | ; Default directory for the Database Engine user database logs. 117 | 118 | SQLUSERDBLOGDIR="<%= @sql_user_db_log_dir %>" 119 | <% end -%> 120 | <% unless @sql_temp_db_dir.nil? -%> 121 | 122 | ; Directory for Database Engine TempDB files. 123 | 124 | SQLTEMPDBDIR="<%= @sql_temp_db_dir %>" 125 | <% end -%> 126 | <% unless @sql_temp_db_log_dir.nil? -%> 127 | 128 | ; Directory for Database Engine TempDB log files. 129 | 130 | SQLTEMPDBLOGDIR="<%= @sql_temp_db_log_dir %>" 131 | <% end -%> 132 | 133 | ; Specify that SQL Server feature usage data can be collected and sent to Microsoft. Specify 1 or True to enable and 0 or False to disable this feature. 134 | 135 | SQMREPORTING="False" 136 | 137 | ; Specify a default or named instance. MSSQLSERVER is the default instance for non-Express editions and SQLExpress for Express editions. This parameter is required when installing the SQL Server Database Engine (SQL), Analysis Services (AS), or Reporting Services (RS). 138 | 139 | INSTANCENAME="<%= @instance_name %>" 140 | 141 | ; Agent account name 142 | 143 | AGTSVCACCOUNT="<%= @agent_account %>" 144 | 145 | ; Auto-start service after installation. 146 | 147 | AGTSVCSTARTUPTYPE="<%= @agent_startup %>" 148 | 149 | <% if @feature_list.include?('IS')%> 150 | ; Startup type for Integration Services. 151 | 152 | ISSVCSTARTUPTYPE="Automatic" 153 | 154 | ; Account for Integration Services: Domain\User or system account. 155 | 156 | ISSVCACCOUNT="NT AUTHORITY\NetworkService" 157 | <% end %> 158 | 159 | ; A port number used to connect to the SharePoint Central Administration web application. 160 | ; The setting 'FARMADMINIPORT' specified is not recognized. 161 | ; FARMADMINIPORT="0" 162 | 163 | ; Startup type for the SQL Server service. 164 | 165 | SQLSVCSTARTUPTYPE="Automatic" 166 | 167 | ; Level to enable FILESTREAM feature at (0, 1, 2 or 3). 168 | 169 | FILESTREAMLEVEL="<%= @filestream_level %>" 170 | 171 | ; Name of Windows share to be created for FILESTREAM File I/O. 172 | 173 | FILESTREAMSHARENAME="<%= @filestream_share_name %>" 174 | 175 | ; Set to "1" to enable RANU for SQL Server Express. 176 | 177 | ENABLERANU="<%= @instance_name == 'SQLEXPRESS' ? "True" : "False" %>" 178 | 179 | ; Specifies a Windows collation or an SQL collation to use for the Database Engine. 180 | 181 | SQLCOLLATION="<%= @sql_collation || 'SQL_Latin1_General_CP1_CI_AS' %>" 182 | 183 | ; Account for SQL Server service: Domain\User or system account. 184 | 185 | SQLSVCACCOUNT="<%= @sql_account %>" 186 | 187 | ; Windows account(s) to provision as SQL Server system administrators. 188 | 189 | SQLSYSADMINACCOUNTS=<%= @sqlSysAdminList %> 190 | 191 | ; Provision current user as a Database Engine system administrator for SQL Server 2008 R2 Express. 192 | 193 | ADDCURRENTUSERASSQLADMIN="<%= @instance_name == 'SQLEXPRESS' ? 'True' : 'False' %>" 194 | 195 | ; Specify 0 to disable or 1 to enable the TCP/IP protocol. 196 | 197 | TCPENABLED="1" 198 | 199 | ; Specify 0 to disable or 1 to enable the Named Pipes protocol. 200 | 201 | NPENABLED="0" 202 | 203 | ; Startup type for Browser Service. 204 | 205 | BROWSERSVCSTARTUPTYPE="<%= @browser_startup %>" 206 | 207 | <% if @feature_list.include?('RS')%> 208 | ; Specifies which account the report server NT service should execute under. When omitted or when the value is empty string, the default built-in account for the current operating system. 209 | ; The username part of RSSVCACCOUNT is a maximum of 20 characters long and 210 | ; The domain part of RSSVCACCOUNT is a maximum of 254 characters long. 211 | 212 | RSSVCACCOUNT="<%= @rs_account %>" 213 | 214 | ; Specifies how the startup mode of the report server NT service. When 215 | ; Manual - Service startup is manual mode (default). 216 | ; Automatic - Service startup is automatic mode. 217 | ; Disabled - Service is disabled 218 | 219 | RSSVCSTARTUPTYPE="<%= @rs_startup %>" 220 | 221 | ; Specifies which mode report server is installed in. 222 | ; Default value: "FilesOnly" 223 | 224 | RSINSTALLMODE="<%= @rs_mode %>" 225 | <% end %> 226 | 227 | <% if @feature_list.include?('FULLTEXT')%> 228 | ; Add description of input arguemtn FTSVCACCOUNT 229 | 230 | FTSVCACCOUNT="NT Service\MSSQLFDLauncher" 231 | <% end %> 232 | 233 | <% if @feature_list.include?('RS_SHP') %> 234 | ; RSInputSettings_RSInstallMode_Description 235 | 236 | RSSHPINSTALLMODE="SharePointFilesOnlyMode" 237 | <% end %> 238 | 239 | <% if @feature_list.include?('AS')%> 240 | ; The name of the account that the Analysis Services service runs under. 241 | 242 | ASSVCACCOUNT=<%= @as_svc_account %> 243 | 244 | ; Controls the service startup type setting after the service has been created. 245 | 246 | ASSVCSTARTUPTYPE="Automatic" 247 | 248 | ; The collation to be used by Analysis Services. 249 | 250 | ASCOLLATION="Latin1_General_CI_AS" 251 | 252 | ; The location for the Analysis Services data files. 253 | 254 | ASDATADIR="Data" 255 | 256 | ; The location for the Analysis Services log files. 257 | 258 | ASLOGDIR="Log" 259 | 260 | ; The location for the Analysis Services backup files. 261 | 262 | ASBACKUPDIR="Backup" 263 | 264 | ; The location for the Analysis Services temporary files. 265 | 266 | ASTEMPDIR="Temp" 267 | 268 | ; The location for the Analysis Services configuration files. 269 | 270 | ASCONFIGDIR="Config" 271 | 272 | ; Specifies whether or not the MSOLAP provider is allowed to run in process. 273 | 274 | ASPROVIDERMSOLAP="1" 275 | 276 | ; Specifies whether or not the MSOLAP provider is allowed to run in process. 277 | 278 | ASPROVIDERMSOLAP="1" 279 | 280 | ; Specifies the list of administrator accounts that need to be provisioned. 281 | 282 | ASSYSADMINACCOUNTS=<%= @asSysAdminList %> 283 | 284 | ; Specifies the server mode of the Analysis Services instance. Valid values are MULTIDIMENSIONAL and TABULAR. The default value is MULTIDIMENSIONAL. 285 | 286 | ASSERVERMODE="MULTIDIMENSIONAL" 287 | <% end %> 288 | 289 | <% if @feature_list.include?('DREPLAY_CTLR')%> 290 | ; The Windows account(s) used to grant permission to the Distributed Replay Controller service. 291 | 292 | CTLRUSERS=<%= @dreplayCtlrList %> 293 | 294 | ; The account used by the Distributed Replay Controller service. 295 | 296 | CTLRSVCACCOUNT="NT Service\SQL Server Distributed Replay Controller" 297 | 298 | ; The startup type for the Distributed Replay Controller service. 299 | 300 | CTLRSTARTUPTYPE="Manual" 301 | <% end %> 302 | 303 | <% if @feature_list.include?('DREPLAY_CLT')%> 304 | ; The computer name that the client communicates with for the Distributed Replay Controller service. 305 | 306 | CLTCTLRNAME="<%= @dreplay_client_name %>" 307 | 308 | ; The account used by the Distributed Replay Client service. 309 | 310 | CLTSVCACCOUNT="NT Service\SQL Server Distributed Replay Client" 311 | 312 | ; The startup type for the Distributed Replay Client service. 313 | 314 | CLTSTARTUPTYPE="Manual" 315 | 316 | ; The result directory for the Distributed Replay Client service. 317 | 318 | CLTRESULTDIR="ResultDir" 319 | 320 | ; The working directory for the Distributed Replay Client service. 321 | 322 | CLTWORKINGDIR="WorkingDir" 323 | <% end %> 324 | 325 | <% if @version == '2016' %> 326 | <% if @feature_list.include?('ADVANCEDANALYTICS' || 'SQL_SHARED_MR') %> 327 | IACCEPTROPENLICENSETERMS=<%= @accept_eula %> 328 | 329 | EXTSVCACCOUNT="NT Service\MSSQLLaunchpad" 330 | <% end %> 331 | <% end %> 332 | 333 | <% if %w(2016 2017 2019 2022).include? @version %> 334 | ; Enables instant file initialization for SQL Server service account. 335 | SQLSVCINSTANTFILEINIT="<%= @sql_instant_file_init ? "True" : "False" %>" 336 | 337 | <% unless @sql_temp_db_file_count.nil? -%> 338 | ; The number of Database Engine TempDB files 339 | 340 | SQLTEMPDBFILECOUNT="<%= @sql_temp_db_file_count %>" 341 | <% end %> 342 | 343 | <% unless @sql_temp_db_file_size.nil? -%> 344 | ; Specifies the initial size of a Database Engine TempDB data file in MB. 345 | 346 | SQLTEMPDBFILESIZE="<%= @sql_temp_db_file_size %>" 347 | <% end %> 348 | 349 | <% unless @sql_temp_db_file_growth.nil? -%> 350 | ; Specifies the automatic growth increment of each Database Engine TempDB data file in MB. 351 | 352 | SQLTEMPDBFILEGROWTH="<%= @sql_temp_db_file_growth %>" 353 | <% end %> 354 | 355 | <% unless @sql_temp_db_log_file_size.nil? -%> 356 | ; Specifies the initial size of the Database Engine TempDB log file in MB. 357 | 358 | SQLTEMPDBLOGFILESIZE="<%= @sql_temp_db_log_file_size %>" 359 | <% end %> 360 | 361 | <% unless @sql_temp_db_log_file_growth.nil? -%> 362 | ; Specifies the automatic growth increment of the Database Engine TempDB log file in MB. 363 | 364 | SQLTEMPDBLOGFILEGROWTH="<%= @sql_temp_db_log_file_growth %>" 365 | <% end %> 366 | 367 | <% if @feature_list.include?('POLYBASE') %> 368 | ; PolybasePdwUserNameConfigDescription 369 | 370 | PBENGSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" 371 | 372 | ; PolybasePdwStartupConfigDescription 373 | 374 | PBENGSVCSTARTUPTYPE="Automatic" 375 | 376 | ; PolybaseDmsUserNameConfigDescription 377 | 378 | PBDMSSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" 379 | 380 | ; PolybaseDmsStartupConfigDescription 381 | 382 | PBDMSSVCSTARTUPTYPE="Automatic" 383 | 384 | ; PolybaseScaleOutDescription 385 | 386 | PBSCALEOUT="False" 387 | 388 | ; PolybasePortRangeDescription 389 | 390 | PBPORTRANGE="<%= @polybase_port_range %>" 391 | <% end %> 392 | <% end %> 393 | 394 | <% if @version == '2017' %> 395 | <% if @feature_list.include?('SQL_INST_MR' || 'SQL_SHARED_MR' || 'SQL_SHARED_AA') %> 396 | IACCEPTROPENLICENSETERMS=<%= @accept_eula %> 397 | <% end%> 398 | 399 | <% if @feature_list.include?('SQL_INST_MPY' || 'SQL_SHARED_MPY' || 'SQL_SHARED_AA') %> 400 | IACCEPTPYTHONLICENSETERMS=<%= @accept_eula %> 401 | <% end %> 402 | 403 | <% if @feature_list.include?('ADVANCEDANALYTICS') %> 404 | EXTSVCACCOUNT="NT Service\MSSQLLaunchpad" 405 | <% end %> 406 | 407 | <% if @feature_list.include?('IS_MASTER')%> 408 | ; Startup type for Integration Services Scale Out Master service. 409 | 410 | ISMASTERSVCSTARTUPTYPE="Automatic" 411 | 412 | ; Account for Integration Services Scale Out Master service: Domain\User or system account. 413 | 414 | ISMASTERSVCACCOUNT="NT Service\SSISScaleOutMaster140" 415 | 416 | ; Port for Integration Services Scale Out Master. 417 | 418 | ISMASTERSVCPORT=<%= @is_master_port %> 419 | 420 | ; The CNs in the certificate used to protect communication with Integration Services Scale Out Worker. 421 | 422 | ISMASTERSVCSSLCERTCN=<%= @is_master_ssl_cert %> 423 | 424 | ; The thumbprint of certificate used to protect communication with Integration Services Scale Out Worker. 425 | 426 | <% if @is_master_cert_thumbprint %> 427 | ISMASTERSVCTHUMBPRINT=<%= @is_master_cert_thumbprint %> 428 | <% end %> 429 | <% end %> 430 | 431 | <% if @feature_list.include?('IS_WORKER') %> 432 | ; Startup type for Integration Services Scale Out Worker service. 433 | 434 | ISWORKERSVCSTARTUPTYPE="Automatic" 435 | 436 | ; Account for Integration Services Scale Out Worker service: Domain\User or system account. 437 | 438 | ISWORKERSVCACCOUNT="NT Service\SSISScaleOutWorker140" 439 | 440 | ; Master endpoint. 441 | 442 | ISWORKERSVCMASTER=<%= @is_worker_master_url %> 443 | <% end %> 444 | <% end %> 445 | -------------------------------------------------------------------------------- /test/cookbooks/test/metadata.rb: -------------------------------------------------------------------------------- 1 | name 'test' 2 | version '0.0.1' 3 | depends 'sql_server' 4 | -------------------------------------------------------------------------------- /test/cookbooks/test/recipes/default.rb: -------------------------------------------------------------------------------- 1 | sql_server_install 'Install SQL' do 2 | sa_password 'Supersecurepassword123' 3 | accept_eula true 4 | end 5 | 6 | sql_server_configure 'SQLEXPRESS' 7 | -------------------------------------------------------------------------------- /test/cookbooks/test/recipes/enterprise.rb: -------------------------------------------------------------------------------- 1 | # Test suite for testing the Enterprise editiions of SQL Server THIS WILL NOT WORK WITHOUT LOCAL INSTALL FILES 2 | 3 | # Install any version of SQL Engine 4 | sql_server_install "Install SQL Server #{node['sql_server']['version']}" do 5 | source_url "C:\\Sources\\SQL_#{node['sql_server']['version']}\\setup.exe" 6 | version node['sql_server']['version'] 7 | package_checksum node['sql_server']['server']['checksum'] 8 | accept_eula true 9 | instance_name 'MSSQLSERVER' 10 | netfx35_install false if node['sql_server']['version'] == 2016 11 | feature %w(SQLENGINE) 12 | end 13 | 14 | sql_server_configure 'MSSQLSERVER' do 15 | version node['sql_server']['version'] 16 | end 17 | -------------------------------------------------------------------------------- /test/integration/server_install/controls/client_spec.rb: -------------------------------------------------------------------------------- 1 | control 'client' do 2 | [ 3 | 'Microsoft SQL Server 2012 Command Line Utilities ', 4 | 'Microsoft SQL Server 2012 Management Objects (x64)', 5 | 'Microsoft SQL Server 2012 Native Client ', 6 | 'Microsoft System CLR Types for SQL Server 2012 (x64)', 7 | 'Windows PowerShell Extensions for SQL Server 2012 ', 8 | ].each do |msql_pkg| 9 | describe package(msql_pkg) do 10 | it { should be_installed } 11 | its('version') { should eq '11.0.2100.60' } 12 | end 13 | end 14 | 15 | describe command 'sqlcmd -?' do 16 | its('exit_status') { should eq 0 } 17 | its('stdout') { should match /SQL Server Command Line Tool/ } 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /test/integration/server_install/controls/server_spec.rb: -------------------------------------------------------------------------------- 1 | version = input('version') 2 | 3 | control 'server' do 4 | describe package("Microsoft SQL Server #{version} (64-bit)") do 5 | it { should be_installed } 6 | end 7 | 8 | describe service('MSSQL$SQLEXPRESS') do 9 | it { should be_installed } 10 | it { should be_running } 11 | end 12 | 13 | describe service('SQLAgent$SQLEXPRESS') do 14 | it { should be_installed } 15 | end 16 | 17 | describe port(1433) do 18 | it { should be_listening } 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /test/integration/server_install/inspec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: server_install 3 | inputs: 4 | - name: version 5 | type: Numeric 6 | required: true 7 | --------------------------------------------------------------------------------