Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

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

    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

    • Every layer counts: Defense in depth for AI agents with Red Hat AI

    • Fun in the RUN instruction: Why container builds with distroless images can surprise you

    • Trusted software factory: Building trust in the agentic AI era

    • Build a zero trust AI pipeline with OpenShift and RHEL CVMs

    • Red Hat Hardened Images: Top 5 benefits for software developers

    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

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    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
    © 2026 Red Hat

    Red Hat legal and privacy links

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

    Chat Support

    Please log in with your Red Hat account to access chat support.