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

How to use automation controller to install MS SQL

5-step demo using the Ansible component automation controller to install Microsoft SQL

March 13, 2023
Nagesh Rathod
Related topics:
Automation and managementContainersLinuxPython
Related products:
Red Hat Ansible Automation PlatformRed Hat Enterprise Linux

Share:

    The purpose of this article is to demonstrate how to create an execution environment with custom dependencies and how to execute Ansible playbooks using the automation controller's GUI, a component of Red Hat Ansible Automation Platform. For this article, we will use Ansible Roles to install Microsoft SQL on Red Hat Enterprise Linux 8.

    Make sure you have the Ansible Automation Platform installed on your machine before you begin. For more information about Ansible Automation Platform installation, please refer to our previous article, How to install Red Hat Ansible Automation Platform on RHEL 9. Follow these five steps to complete this demonstration.

    Step 1. Setting up the automation execution environment

    Automation execution environments provide a defined, consistent, and portable environment for executing automation jobs. Unlike legacy virtual environments, automation execution environments are Linux container images that make it possible to incorporate system-level dependencies and collection-based content. Each automation execution environment allows you to have a customized image to run jobs, and each of them contains only what you need when running the job.

    There are dependencies for the automation execution environment, such as Python 3 and Podman. Make sure these tools are installed. We have provided instructions for installing and using Podman in this video.

    Before you can complete any of the following tasks, you must create a registry service account. To log in, open up your terminal and type the following commands:

    podman login registry.redhat.io
    Username: {REGISTRY-SERVICE-ACCOUNT-USERNAME}
    Password: {REGISTRY-SERVICE-ACCOUNT-PASSWORD}
    Login Succeeded!

    Once we are successfully logged in, we need to create a container image by using a Containerfile containing the following context:

    ​​​​​​​FROM registry.redhat.io/ansible-automation-platform-22/ee-29-rhel8:latest
    
    RUN ansible-galaxy collection install microsoft.sql

    To build an image using Podman, enter the following:

    ​​​​​​​podman build -t <image-name>.

    The image should be pushed into the container image registry. Log in to the private container image registry using the command 'podman login' before pushing.

    podman push <image-name>

    Add the image name in the automation execution environment, as shown in Figure 1.

    The edit details section of the Execution Environment page in Ansible Automation Platform.
    Figure 1: The Execution Environment page.

     

    Step​​​​​​​ 2. Set up the inventory

    An inventory is a collection of hosts against which jobs may be launched. To create inventory in Ansible Automation Platform, follow these steps and refer to Figure 2:

    1. Select the inventory from the left menu.
    2. Click on add.
    3. Select add inventory.
    4. Give a name to the inventory and save it.
    5. Select the hosts from inventories and click add hosts.
    6. Give the targeted server IP or name and save it.
    The Inventory page in Ansible Automation Platform.
    Figure 2: The Inventory page.

     

    Step 3. Set up the credentials

    To connect with the target server, we need credentials such as username, password, or ssh key. By using credentials, we can pass the required credentials during the playbook execution.

    Follow these steps and refer to Figure 3:

    1. Select the credentials from the left menu.
    2. Click on new credentials and select Machine credentials type.
    3. Add your username, password, or ssh key in the corresponding fields.
    The credentials page in Ansible Automation Platform.
    Figure 3: The credentials page.

     

    Step 4. Configuring a project

    A project is a logical collection of Ansible Playbooks represented in the controller. You can manage playbooks and playbook directories on your controller server either manually or by using a source code management (SCM) system such as Git, Subversion, or Mercurial supported by the controller.

    Follow these steps to create a project and refer to Figure 4:

    1. Create a new project for our git repository from the left menu.
    2. Click on the + icon in the right corner.
    3. Give the project a name.
    4. Select your organization (or choose Default).
    5. Select the SCM TYPE (GIT in our case).
    6. Add RESOURCE DETAILS
      • SCM URL
      • SCM BRANCH(main)
      • SCM CREDENTIAL
    7. Save it.
    The Project page of Ansible Automation Platform.
    Figure 4: The Project page.

     

    Step 5. Configuring templates

    Templates define and set parameters for running jobs. A template is more like a blueprint where all of the dependencies are defined, such as inventory, projects, credentials, etc.

    Follow these steps to create a template to execute the job for us (see Figure 5):

    1. From the left menu, select templates and create a new template.
    2. Click on + icon from the right corner and select the Job template.
    3. Give the template a name.
    4. Select the project and playbook you want to run in the template.
    5. Select microsoft_sql_playbook.yaml playbook.
    6. Select the execution environment which you created previously.
    ---
    
    - hosts: dev
    
      collections:
      - microsoft.sql
    
      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​
    The templates page in Ansible Automation Platform.
    Figure 5: The Templates page.

    7. ​​​​​​​Launch it (Figure 6).

    After launching, this page shows the output of a successful installation of MicrosoftSQL server.
    Figure 6: After launching, a successful installation of MicrosoftSQL server.

     

    Continue your automation journey with Ansible

    Get started with the Ansible Automation Platform by exploring interactive labs. Ansible Automation Platform is also available as a managed offering on Microsoft Azure and as a self-managed offering on AWS.

    Last updated: August 14, 2023

    Related Posts

    • Managing Windows Updates with Ansible in Red Hat Enterprise Linux

    • Write your own Red Hat Ansible Tower inventory plugin

    • Customizing an OpenShift Ansible Playbook Bundle

    • Customizing an OpenShift Ansible Playbook Bundle

    Recent Posts

    • More Essential AI tutorials for Node.js Developers

    • How to run a fraud detection AI model on RHEL CVMs

    • How we use software provenance at Red Hat

    • Alternatives to creating bootc images from scratch

    • How to update OpenStack Services on OpenShift

    What’s up next?

    This cheat sheet gets you started using Ansible to automate tasks on Cisco Meraki, an enterprise-cloud managed networking solution for managing access points, security appliances, L2 and L3 switches, and more.

    Get the cheat sheet
    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