Today, we'll look at how to automate SQL Server deployment and configuration on Linux. To automate our deployment, we will use the Ansible system role, which is available here.
Note: The Ansible system role that I use in this blog is a sample system role that is provided as is and for reference only. Microsoft and Red Hat do not support this. However, I invite you to provide feedback and suggestions for improving the system role here: Issues linux-system-roles/mssql (github.com).
Update as of July 2022: Please note that SQL Server system roles are now available as default and more information is available here: Configuring Microsoft SQL Server using Microsoft SQL Server Ansible role Red Hat Enterprise Linux 8 ...
To begin, we must first prepare the environment. Here are the steps we will follow in this blog.
Solution Diagram for reference:
Let's get started; I'll use three Azure VMs to set up this environment:
#Confirm pip3 is installed
pip3 –help
#Now install ansible using the command pip3
pip3 install ansible
Please follow the steps below only if you do not already have passwordless ssh access configured between the controller and the target/managed nodes.
Note: In this example, I am using the root user, in a production environment this is not recommended. Instead of the all-powerful root, use a regular user account with sudo access.
ansible-galaxy collection install microsoft.sql
- hosts: all
vars:
mssql_accept_microsoft_odbc_driver_17_for_sql_server_eula: true
mssql_accept_microsoft_cli_utilities_for_sql_server_eula: true
mssql_accept_microsoft_sql_server_standard_eula: true
mssql_password: "YourP@ssw0rd"
mssql_edition: Evaluation
mssql_enable_sql_agent: true
mssql_install_fts: true
mssql_install_powershell: true
mssql_tune_for_fua_storage: true
roles:
- microsoft.sql.server
To deploy SQL Server on managed servers, execute the following command from the controller node:
ansible-playbook -u root playbook.yaml
This will begin the deployment, and at the end, you should see a summary of the play, with the title "play recap," that looks like this:
PLAY RECAP *******
10.0.0.12 : ok=31 changed=42 unreachable=0 failed=0 skipped=0 rescued=1 ignored=0
10.0.0.14 : ok=31 changed=42 unreachable=0 failed=0 skipped=0 rescued=1 ignored=0
The figures in your case may differ. For a hands-on experience, try the Red Hat Enterprise Linux Interactive Lab Portal lab, which is provided by our friends at Red Hat, Inc. I hope this helps you get started, and please share your thoughts and suggestions about the system role here: Issues linux-system-roles/mssql (github.com).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.