Este conteúdo não está disponível no idioma selecionado.
Chapter 23. Configuring Microsoft SQL Server using the microsoft.sql.server Ansible role
As an administrator, you can use the microsoft.sql.server Ansible role to install, configure, and start Microsoft SQL Server (SQL Server). The microsoft.sql.server Ansible role optimizes your operating system to improve performance and throughput for the SQL Server. The role simplifies and automates the configuration of your RHEL host with recommended settings to run the SQL Server workloads.
23.1. Prerequisites Copiar o linkLink copiado para a área de transferência!
- 2 GB of RAM
-
rootaccess to the managed node where you want to configure SQL Server Pre-configured firewall
You can set the
mssql_manage_firewallvariable totrueso that the role can manage firewall automatically.Alternatively, enable the connection on the SQL Server TCP port set with the
mssql_tcp_portvariable. If you do not define this variable, the role defaults to the TCP port number1433.To add a new port, use:
firewall-cmd --add-port=xxxx/tcp --permanent firewall-cmd --reload
# firewall-cmd --add-port=xxxx/tcp --permanent # firewall-cmd --reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow Replace xxxx with the TCP port number then reload the firewall rules.
-
Optional: Create a file with the
.sqlextension containing the SQL statements and procedures to input them to SQL Server.
23.2. Installing the microsoft.sql.server Ansible role Copiar o linkLink copiado para a área de transferência!
The microsoft.sql.server Ansible role is part of the ansible-collection-microsoft-sql package.
Prerequisites
-
rootaccess
Procedure
Install Ansible Core which is available in the RHEL 7.9 AppStream repository:
*yum install ansible-core*
# *yum install ansible-core*Copy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
microsoft.sql.serverAnsible role:*yum install ansible-collection-microsoft-sql*
# *yum install ansible-collection-microsoft-sql*Copy to Clipboard Copied! Toggle word wrap Toggle overflow
23.3. Installing and configuring SQL server using the microsoft.sql.server Ansible role Copiar o linkLink copiado para a área de transferência!
You can use the microsoft.sql.server Ansible role to install and configure SQL server.
Prerequisites
- The Ansible inventory is created
Procedure
-
Create a file with the
.ymlextension. For example,mssql-server.yml. Add the following content to your
.ymlfile:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace <password> with your SQL Server password.
Run the
mssql-server.ymlansible playbook:*ansible-playbook mssql-server.yml*
# *ansible-playbook mssql-server.yml*Copy to Clipboard Copied! Toggle word wrap Toggle overflow
23.4. TLS variables Copiar o linkLink copiado para a área de transferência!
You can use the following variables to configure the Transport Level Security (TLS) protocol.
| Role variable | Description |
|---|---|
| mssql_tls_enable | This variable enables or disables TLS encryption.
The
When set to |
| mssql_tls_cert | To define this variable, enter the path to the TLS certificate file. |
| mssql_tls_private_key | To define this variable, enter the path to the private key file. |
| mssql_tls_remote_src |
Defines if the role searches for
When set to the default
When set to |
| mssql_tls_version | Define this variable to select which TSL version to use.
The default is |
| mssql_tls_force |
Set this variable to
The default is |
23.5. Accepting EULA for MLServices Copiar o linkLink copiado para a área de transferência!
You must accept all the EULA for the open-source distributions of Python and R packages to install the required SQL Server Machine Learning Services (MLServices).
See /usr/share/doc/mssql-server for the license terms.
| Role variable | Description |
|---|---|
| mssql_accept_microsoft_sql_server_standard_eula |
This variable determines whether to accept the terms and conditions for installing the
To accept the terms and conditions set this variable to
The default is |
23.6. Accepting EULAs for Microsoft ODBC 17 Copiar o linkLink copiado para a área de transferência!
You must accept all the EULAs to install the Microsoft Open Database Connectivity (ODBC) driver.
See /usr/share/doc/msodbcsql17/LICENSE.txt and /usr/share/doc/mssql-tools/LICENSE.txt for the license terms.
| Role variable | Description |
|---|---|
| mssql_accept_microsoft_odbc_driver_17_for_sql_server_eula |
This variable determines whether to accept the terms and conditions for installing the
To accept the terms and conditions set this variable to
The default is |
| mssql_accept_microsoft_cli_utilities_for_sql_server_eula |
This variable determines whether to accept the terms and conditions for installing the
To accept the terms and conditions set this variable to
The default is |
23.7. High availability variables Copiar o linkLink copiado para a área de transferência!
You can configure high availability for Microsoft SQL Server with the variables from the table below.
| Variable | Description |
|---|---|
|
|
The default value is
When it is set to
|
|
|
This variable specifies which type of replica you can configure on the host. You can set this variable to |
|
|
The default port is The role uses this TCP port to replicate data for an Always On availability group. |
|
| You must define the name of the certificate to secure transactions between members of an Always On availability group. |
|
| You must set the password for the master key to use with the certificate. |
|
| You must set the password for the private key to use with the certificate. |
|
|
The default value is
If it is set to |
|
| You must define the name of the endpoint to configure. |
|
| You must define the name of the availability group to configure. |
|
| You can define a list of the databases to replicate, otherwise the role creates a cluster without replicating databases. |
|
| The SQL Server Pacemaker resource agent utilizes this user to perform database health checks and manage state transitions from replica to primary server. |
|
|
The password for the |
|
|
The default value is
This variable defines if this role runs the
Note that the
To work around this limitation, the
If you want the |
Note, this role backs up the database to the /var/opt/mssql/data/ directory.
For examples on how to use high availability variables for Microsoft SQL Server:
-
If you install the role from Automation Hub, see the
~/.ansible/collections/ansible_collections/microsoft/sql/roles/server/README.mdfile on your server. -
If you install the role from a package, open the
/usr/share/microsoft/sql-server/README.htmlfile in your browser.