Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Deploying SQL Server on Linux using an Ansible playbook

July 16, 2024
Vivien Wang Arne Arnold Amit Khandelwal (Microsoft)
Related topics:
Data integrationDeveloper Tools
Related products:
Microsoft SQL Server on Red Hat Enterprise LinuxRed Hat Ansible Automation Platform

Share:

    Why deploy SQL Server on Linux using an Ansible playbook? The answer is that automation is a key aspect of modern IT operations, which is why we at Red Hat are delighted to announce that the deployment and configuration of Microsoft SQL Server on Red Hat Enterprise Linux (RHEL) can be easily automated using Ansible and corresponding RHEL system roles for SQL Server. You can deploy high availability (HA) solutions, including configuring Always On availability groups. Ansible scripts can automate the entire deployment process, reducing manual intervention and minimizing errors.

    SQL Server 2022 has as of July 2024 been officially certified with RHEL 9, and is now Generally Available on Red Hat Ecosystem Catalog.

    Sounds good—what do I need to do?

    First off, you’ll need an Azure subscription to get this set up. If you don't have an Azure subscription, you can easily create a free account here. You will also need to create a new resource group using Azure CLI, which contains three Azure virtual machines (VMs).

    The first VM, where you configure Ansible Core, is the controller node. On this node, you'll install the SQL Server system role.

    The remaining VMs are the target machines, also known as managed nodes, for deploying and configuring SQL Server using the system role.

    Installing Ansible Core

    Starting with RHEL 8.x on Azure VMs, the ansible-core package can be installed from the pre-configured AppStream repository. You can install Ansible Core on the controller node using the following command:

    sudo dnf install ansible-core

    In RHEL 9, software installation is ensured by dnf rather than yum—however, Red Hat continues to support the usage of yum for consistency with previous major versions of RHEL. If you type dnf instead of yum, the command works as expected because both are aliases for compatibility.

    Although RHEL 8 and RHEL 9 are based on DNF, they are compatible with YUM used in RHEL 7.

    For more information, see Managing software with the DNF tool and Package management with DNF/YUM in RHEL 9.

    You can check whether the installation was successful with the following command:

    ansible --version

    Configuring passwordless SSH access between nodes

    You will need to configure a Secure Shell (SSH) connection between the controller node and all managed nodes where the SQL Server is to be installed.

    Installing the SQL Server system role

    The Ansible system role is called ansible-collection-microsoft-sql. On the controller node, run the following command to install the SQL Server system role:

    sudo yum install ansible-collection-microsoft-sql

    This command will install the SQL Server role to /usr/share/ansible/collections:

    -rw-r--r--. 1 user user 7592 Jul  2 20:22 FILES.json
    -rw-r--r--. 1 user user 1053 Jul  2 20:22 LICENSE-server
    -rw-r--r--. 1 user user  854 Jul  2 20:22 MANIFEST.json
    -rw-r--r--. 1 user user 1278 Jul  2 20:22 README.md
    drwxr-xr-x. 1 user user   20 Jul  2 20:22 roles
    drwxr-xr-x. 1 user user   20 Jul  2 20:22 tests

    Creating and configuring the Ansible playbook

    After installing the system role, you'll need to create the SQL Server playbook YAML file. To understand the various role variables, refer to the documentation or the README.md included with the SQL Server system role.

    To learn more about the inventory creation and sample playbook.yaml to run in next command, refer to the "creating inventory and playbook section" in Deploy Always On Availability Groups (AG) on SQL Server RHEL based Azure VMs - The Ansible Way.

    Deploying SQL Server on the managed nodes

    To deploy SQL Server on managed nodes using the Ansible playbook, run the following command from the controller node:

    sudo ansible-playbook -u user playbook.yaml

    This process will begin the deployment.

    Removing resources

    If you're not going to continue using your Azure VMs, please remember to remove them. If you created the three VMs in a new resource group, you can remove all the resources inside that resource group using Azure CLI.

    Background

    Red Hat and Microsoft have partnered for almost a decade to engineer innovative and validated solutions to customers. One of the latest results of this collaboration has been the general availability of Microsoft SQL Server 2022 on Red Hat Enterprise Linux (RHEL) 9, a joint solution that was highlighted at the recent Red Hat Summit 2024 in Denver, Colorado. 

    SQL Server is highly adaptable and can be deployed in various configurations on RHEL, including containers, virtual guests, and bare-metal deployments using rpm packages. Microsoft SQL Server also integrates seamlessly with Azure Arc, enabling a unified management experience across hybrid and multi-cloud environments and simplifies operations and enhances visibility for SQL Server deployments in diverse infrastructure setups.

    Your benefits from migrating to SQL 2022 on RHEL 9

    With RHEL 7 reaching its End of Maintenance on June 30, 2024 and RHEL 8 being out of full support since May 31, 2024, customers should ensure that their mission critical data infrastructure remains up-to-date and secure. 

    For deploying SQL Server 2022 on RHEL 9, a system with a minimum of 2 cores and 2 GB of memory is required. However, for optimal performance, a system with 4 cores and 8 GB of memory is recommended. Additionally, ensure you have a minimum of 6 GB of disk space for the SQL Server installation. It is crucial to have a compatible file system, such as XFS or EXT4, for optimal storage management.

    Migrating to SQL 2022 on top of RHEL 9 offers substantial business benefits, including cost reduction, simplified configuration and management of SQL Server workloads, and enhanced security. For organizations currently using CentOS Linux, transitioning to RHEL can provide a more robust and supported environment, ensuring better performance and reliability.

    Where I can learn more about Red Hat Enterprise Linux 9 for SQL Server 2022?

    Here are some links to get you started: 

    • Red Hat Enterprise Linux for Microsoft SQL Server 
    • Migrate your SQL Server workloads to Red Hat Enterprise Linux 
    • RHEL leads SQL Server deployments on Linux
    • Get started with SQL on Linux
    • Get started with Microsoft Fabric
    • Stratis-managed file systems for SQL on RHEL

    Try out Red Hat Enterprise Linux Server with our free trial. 

    Related Posts

    • Using a MySQL database in your Red Hat OpenShift application

    • MySQL for developers in Red Hat OpenShift

    • Deploying a Spring Boot App with MySQL on OpenShift

    • Customizing an OpenShift Ansible Playbook Bundle

    • Using Ansible Galaxy Roles in Ansible Playbook Bundles

    Recent Posts

    • Meet the Red Hat Node.js team at PowerUP 2025

    • How to use pipelines for AI/ML automation at the edge

    • What's new in network observability 1.8

    • LLM Compressor: Optimize LLMs for low-latency deployments

    • How to set up NVIDIA NIM on Red Hat OpenShift AI

    What’s up next?

    Discover the basics of creating Ansible playbooks using practical examples, including key components such as plays, tasks, modules, and more in this Learning Path.

    Start the activity
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue