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

Streamline multi-cloud operations with Ansible and ServiceNow

June 19, 2025
Raul Leite
Related topics:
Automation and managementDevOpsHybrid CloudIntegration
Related products:
Red Hat Ansible Automation PlatformRed Hat Ansible Automation Platform on Microsoft AzureRed Hat Ansible Automation Platform via AWS Marketplace

Share:

    Hybrid and multi-cloud environments introduce operational complexity. However, integrating Red Hat Ansible Automation Platform with ServiceNow for public cloud bridges the gap between automation and IT service management (ITSM). This article explains how this integration enables teams to operate more swiftly, intelligently, and with fewer manual bottlenecks. 

    4 benefits of the Ansible & ServiceNow integration

    Keeping IT operations smooth while managing multi-cloud environments (i.e., Amazon Web Services, AWS and Azure) is a growing challenge. Let's dive into how this powerful combination transforms cloud and IT operations, from automated incident remediation to self-service provisioning and real-time CMDB synchronization. 

    Figure 1 depicts this integration in a multi-cloud architecture environment.

    Diagram depicting multi-cloud architecture environment.
    Figure 1: Multi-cloud architecture environment.

    1. Automated incident resolution

    When cloud infrastructure fails—whether it's an AWS EC2 crash, CPU spike, an Azure virtual machine (VM) disk filling up, or a network misconfiguration—ServiceNow can automatically trigger Ansible playbooks to fix the issue before it impacts users.  

    For example, let's say ServiceNow receives an alert from AWS CloudWatch about a spiking CPU.  

    An Ansible playbook executes to:  

    • Scale up the instance (or deploy a new one).
    • Restart the failing service.
    • Log all actions back in ServiceNow for audit trails.  

    The cpu_remmediation.yaml playbook follows:

    ---
    - name: Use ServiceNow CMDB as Dynamic Inventory
      hosts: servicenow.cmdb_ci_cloud_instance
      connection: local
      gather_facts: false
      tasks:
        - name: List all AWS EC2 instances from ServiceNow
          debug:
            msg: "Instance {{ item.name }} (ID: {{ item.sys_id }}) is in {{ item.cloud }}"
          loop: "{{ query('servicenow.snow_record', table='cmdb_ci_cloud_instance',
            query='cloud=AWS') }}"

    2. Effortless multi-cloud infrastructure deployment  

    Deploying and managing resources across AWS, Azure, and on-premise environments becomes seamless with the Ansible Automation Platform infrastructure-as-code (IaC) capabilities tracked within ServiceNow.  

    In this example, a compliance policy requires OS updates across 500 servers. The Ansible Automation Platform applies the patch and logs the change in ServiceNow for audit trails.

    The dynamic_inventory_snow.yml playbook follows: 

    ---
    - name: Use ServiceNow CMDB as Dynamic Inventory
      hosts: servicenow.cmdb_ci_cloud_instance
      connection: local
      gather_facts: false
      tasks:
        - name: List all AWS EC2 instances from ServiceNow
          debug:
            msg: "Instance {{ item.name }} (ID: {{ item.sys_id }}) is in {{ item.cloud }}"
          loop: "{{ query('servicenow.snow_record', table='cmdb_ci_cloud_instance',
            query='cloud=AWS') }}"

    3. Self-service cloud provisioning

    Self-service cloud provisioning allows teams to request cloud resources (i.e., AWS S3 buckets or Azure VMs) through the ServiceNow service catalog, while Ansible Automation Platform handles the deployment behind the scenes.

    In this example, a developer requests an Azure Kubernetes (AKS) cluster via ServiceNow. Ansible Automation Platform automates the provisioning, ensuring proper tagging and security policies.

    The following is the provisioning_az_rhel.yml playbook:

    ---
    - name: Provision Azure RHEL VM from ServiceNow Request
      hosts: localhost
      vars:
        snow_request_id: "{{ snow_request_id }}"
      tasks:
        - name: Get request details from ServiceNow
          servicenow.itsm.request_item:
            sys_id: "{{ snow_request_id }}"
          register: request_details
        - name: Deploy Azure RHEL VM
          azure.azcollection.azure_rm_virtualmachine:
            resource_group: "{{ request_details.resource_group }}"
            name: "{{ request_details.vm_name }}"
            vm_size: Standard_B2s
            admin_username: azureuser
            ssh_public_keys:
              - path: /home/azureuser/.ssh/authorized_keys
                key_data: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABA...
            image:
              offer: RHEL
              publisher: RedHat
              sku: 8-lvm
              version: latest
            os_disk_size_gb: 64
        - name: Register VM in ServiceNow CMDB
          servicenow.itsm.cmdb_ci_cloud_instance:
            name: "{{ request_details.vm_name }}"
            ip_address: "{{ azure_vm.ip_address }}"
            cloud: Azure
            operational_status: In Production
            sys_class_name: cmdb_ci_cloud_instance
        - name: Update ServiceNow request as fulfilled
          servicenow.itsm.request_item:
            sys_id: "{{ snow_request_id }}"
            state: Closed
            close_notes: "RHEL VM {{ request_details.vm_name }} provisioned in Azure (IP: {{
              azure_vm.ip_address }})."
    

    4. Cloud cost optimization

    Ansible Automation Platform can automatically decommission unused cloud resources (i.e., idle AWS EC2 instances) based on ServiceNow data, reducing waste and controlling costs.

    In this example, ServiceNow flags an untagged, unused virtual machine (VM). Ansible Automation Platform shuts it down, terminates it, and updates the CMDB.

    The cost_svgs_untag.yml playbook is as follows: 

    ---
    - name: Delete Unused AWS EC2 Instances
      hosts: localhost
      vars:
        unused_threshold_days: 30
      tasks:
        - name: Get all EC2 instances not in ServiceNow CMDB
          amazon.aws.ec2_instance_info:
            filters:
              tag:Owner: absent
          register: aws_instances
        - name: Terminate unused instances
          amazon.aws.ec2_instance:
            instance_id: "{{ item.instance_id }}"
            state: terminated
          loop: "{{ aws_instances.instances }}"
          when: item.launch_time | datetime_diff('now', 'days') > unused_threshold_days
        - name: Log deleted instances in ServiceNow
          servicenow.itsm.change_request:
            short_description: Cleaned up unused EC2 instances
            description: "Terminated: {{ aws_instances.instances |
              map(attribute='instance_id') | list }}"

    Why this integration matters

    Combining the power of Ansible Automation Platform with the capabilities of ServiceNow ITSM creates a seamless, event-driven cloud management experience. Whether you’re handling incidents, changes, or provisioning, this integration helps IT teams work smarter across multi-cloud environments, as well as:

    • Faster response times: Event-driven automation means fewer manual tickets.
    • Consistency: You can enforce policies uniformly across AWS, Azure, and hybrid environments.
    • Audit-friendly features: You can track every automated action in ServiceNow.

     Figure 2 shows a the overall workflow discussed in this article.

    Diagram depicting a summary of the workflow explained in the article.
    Figure 2: Summary of the workflow explained in the article.

    Explore more

    Want to dive deeper? Start by exploring the Ansible Automation Platform and ServiceNow modules to experiment with simple playbooks and witness the impact firsthand.

    Explore the Ansible Automation Platform and ServiceNow integration:

    • Ansible Certified Content Collection for ServiceNow ITSM
    • Simplify ServiceNow ITSM with Red Hat

    Related Posts

    • Transforming ITSM with Ansible Automation: A Gradual Approach

    • How to deploy applications using Ansible Automation Platform

    • How Ansible Automation task scheduling improves productivity

    • Multi-cloud storage strategies for SaaS applications

    • Event-driven architecture: What is an event?

    Recent Posts

    • Integrate Red Hat AI Inference Server & LangChain in agentic workflows

    • Streamline multi-cloud operations with Ansible and ServiceNow

    • Automate dynamic application security testing with RapiDAST

    • Assessing AI for OpenShift operations: Advanced configurations

    • OpenShift Lightspeed: Assessing AI for OpenShift operations

    What’s up next?

    Automate time-consuming tasks like credentials, accounts, and templates and create a centralized process with Ansible Automation Platform and the Developer Sandbox.

    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