Microsoft SQL Role Usage Guide
Requirements
- Outbound access to cdn.powershellgallery.com and www.powershellgallery.com to download required PowerShell modules. If outbound access is not available, the required modules can be manually installed. The required modules are:
- SqlServer
- SqlServerDsc
- ServerManager
- StorageDsc
- dbatools
- xNetworking
Prerequisites
- Storage must be provisioned on the host(s) Microsoft SQL will be installed on. This can be done using the storage roles. If ephemeral storage is being used for tempdb, it must be manually configured using AWS/Azure best practices.
- Required AD accounts (e.g. GMSAs) must be created. The create-gmsa.yml playbook can be used to create GMSAs in Active Directory.
- Either a customer provided ISO or a copy of Microsoft SQL Server Developer Edition (e.g. SQLServer2022-x64-ENU-Dev.iso).
- The following variables must be defined. Use a secure password generator to create strong passwords. The variables should be all uppercase when defined as environment variables, but all lowercase when defined in
host_varsorgroup_varsfiles or an ansible vault.
Usage
- Create a file in
host_varsfor each host Microsoft SQL will be installed on if it doesn't already exist. The file should be named after the host's inventory name (e.g.host_vars/abcmsql01.yml). - A SQL ISO is required to install Microsoft SQL Server. The playbook supports delivering it via HTTP(S) (e.g. storage account, S3 bucket, caddy file server, etc.) or by uploading it from the Ansible control node.
- When uploading files from the Ansible control node, place the ISO in a "shared files" directory on the ansible control node (usually a location on the container's persistent storage in
/home/ansible/source/files) and setshared_files_directoryingroup_varsto the path of the directory. If themicrosoft_sql_install_source_dirvariable is defined inhost_vars, it will overrideshared_files_directoryfor that host. - If the value of
shared_files_directoryormicrosoft_sql_install_source_diris a URL, the playbook will attempt to download the ISO from that location. If it's a local file path, the playbook will attempt to upload the ISO from the Ansible control node.microsoft_sql_install_source_fileshould be set to the name of the ISO file (e.g. 'SQLServer2019.iso').
- When uploading files from the Ansible control node, place the ISO in a "shared files" directory on the ansible control node (usually a location on the container's persistent storage in
-
Update each hosts
host_varswith the necessary variables using the sample variables below or navigate totemplatesto see more examples.SQL Template Variables
If you are deploying a multipurpose SQL server for Kuiper/System Pulse, ensure variables in the template are configured to grant database permissions to both the user account running the Kuiper installation Ansible role and the Kuiper GMSA.
-
Run the
playbooks/deploy-microsoft-sql.ymlplaybook. This playbook calls themicrosoft-sqlrole to install Microsoft SQL and dependencies, configure databases, users, permissions, firewall rules, etc. It also contains some tasks specific to Kuiper/System Pulse deployments.
Sample Variables
SQL Template Variables
The sample below is for a Kuiper/System Pulse multipurpose SQL Deployment. Be sure to customize environment specific variables in the template. Many of the lines containing environment specific values are highlighted in the code block below. See comments for more information.