Skip to main content
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 Red Hat 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

    • Red Hat OpenShift AI
    • 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.

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

    • 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.

ConsoleDocsSupport Search
New For you

Recommended

We'll recommend resources you may like as you browse. Try these suggestions for now.

  • Product downloads
  • Cheat sheets
  • Red Hat Developer learning portal
  • Developer blog
  • E-books
  • Developer Sandbox
Log in

Get more with a Red Hat Developer account

  • Product downloads
  • Console access
  • Event registration
  • Training & trials
Explore more account benefitsLog in or register

A subscription may be required for some services.

Contact us

How to migrate smart inventories to constructed inventories

August 11, 2025
Konstantin Kuminsky
Related topics:
Automation
Related products:
Red Hat Ansible Automation Platform

    Note

    This blog utilizes an Ansible collection (configify.aapconfig) that's developed, published, and maintained by the Ansible community. Refer to the validated infra.aap_configuration Ansible collection supported by Red Hat.

    So far in this article series, we talked about managing or migrating configurations of the whole Red Hat Ansible Automation Platform cluster. This article is a little different. We will talk about the migration of one specific object, inventories.

    For a number of years, smart inventories were a very useful tool for running workloads on a subset of existing hosts without duplicating them. Recently, Red Hat announced plans to discontinue support of smart inventories in favor of constructed inventories. The feature will be discontinued in the future releases of Ansible Automation Platform.

    The change is being made for a good reason, smart inventories are not without their challenges and are limited in the way the filters are being applied. However the announced change also raises a challenge of migrating existing Smart inventories to the new format. For large organizations with hundreds of Smart inventories manual migration would be a long and tedious process.

    This article offers a semi-automated process to save time and effort during the migration.

    Migration challenges

    Smart inventories are defined by filtering existing hosts using one or more conditions joined together by ‘or’ and ‘and’ operators. The conditions are applied sequentially as they are written, which is not going to cause issues in most cases. However for more complex conditions and host names, the resulting list of hosts may not be the desired one. In general case:

    condition1 AND condition2 OR condition3

    is not the same as

    condition1 OR condition3 AND condition2

    We’ve seen some organizations use round brackets to control the sequence of specified conditions. This may work but it’s not something that can be configured via GUI.

    On the other hand constructed inventories filter hosts from one or more existing inventories, which is a part of the configuration. In addition, conditions are always applied in the following order:

    : (or) -> & (and) -> ! (not)

    These differences raise two challenges for the migration we are about to do. First, converting conditions specified in a smart inventory as they are listed is likely to produce a different list of hosts as these conditions will be applied in different order in constructed inventory.

    Second, if existing smart inventory is currently empty it is not possible to define the source inventory for future constructed inventory. This field is mandatory however and constructed inventory can not be created without it.

    The challenges make it very difficult if not impossible to perform fully automated migration. Thus human review of the resulting configurations will be required before configurations are applied, which makes this approach semi-automatic.

    The migration approach

    Considering the previous migration approach is to:

    1. Convert filtering conditions into the format suitable for constructed inventories:
      • The or and and operators will be replaced with : and &.
      • The conditions containing startswith, such as name__startswith=condition will be replaced with condition*
      • The conditions containing icontains, such as groups__name__icontains=condition or name__icontains=condition will be replaced with condition.
      • The conditions containing regex such as name__regex=condition or groups__name__regex=condition will be replaced with ~condition.
    2. Determine the list of inventories the hosts from existing smart inventories belong to and use that list in the input field for constructed inventories.
    3. Review resulting configurations, make adjustments as required, and apply them.

    Migration steps

    We’ve done the preparation steps described in part 1: configured Ansible Automation Platform to access configify.aapconfig collection, its dependencies, and to run playbooks from this collection. Now let’s create the following playbook and run it:

    ---
    - name: Run playbook to export Smart inventories in Constructed inventories format
      import_playbook: configify.aapconfig.convert_smart_inventories.yml

    The resulting output, after double quotes are removed, will look similar to the following:

    controller_objects_inventories_constructed: [
      {'name': 'Smart1 migrated', 'descr': '', 'org': 'Default', 'input': ['Hosts'],
       'source_vars': {'plugin': 'constructed', 'strict': True}, 'limit': '*Host*', 'source': ''},
      {'name': 'Smart2 migrated', 'descr': '', 'org': 'Default', 'input': ['Servers'],
       'source_vars': {'plugin': 'constructed', 'strict': True}, 'limit': 'Server*', 'source': ''}
    ]

    This output in the example corresponds to the following two smart inventories:

    controller_objects_inventories_smart: [
      {'name': 'Smart1', 'description': '', 'org': 'Default', 'variables': {},
       'host_filter':  'name__icontains=Host'},
      {'name': 'Smart2', 'description': '', 'org': 'Default', 'variables': {},
       'host_filter': 'name__startswith=Server'}"
    ]

    A human being must review the output produced by the playbook:

    • If there are empty input fields, decide which inventory should act as a source or remove the line (which means the inventory will not be migrated).
    • Search for "=" in the limit field. These are the filters that need to be converted manually.
    • Search for "(" in the limit field. The brackets need to be removed unless they are a part of a regex.
    • Check for any other issues.

    After the review, add the resulting configuration to the existing CaC and apply it using configify.aapconfig.aap_configure.yml playbook, specifying the following:

    tags:
      controller_config_inventories_apply
    extra_vars:
      sync_inventory_sources: true

    This will create constructed inventories with the word "migrated" in the name corresponding to existing smart inventories and populate hosts in them (synchronize them).

    Next, verify that the hosts in the new constructed inventories are the same as in their corresponding smart inventories. To do that, let’s run the configify.aapconfig.compare_inventory_hosts.yml playbook. If there are any differences, troubleshoot them, adjust configurations as required, and reapply.

    To finalize the migration we need to:

    1. Remove smart inventories from the CaC and rerun automation with: 

      tags:   
       controller_config_inventories_cleanup 
      extra_vars: 
       delete_object: true
    2. Rename constructed inventories (remove the word "migrated" from the name) and reapply configuration with:

       tags: 
        controller_config_inventories 
       extra_vars: 
        delete_object: true
    3. At this point job templates and workflows that were using smart inventories are broken as these inventories have been deleted. To fix that, simply reapply configurations so that new constructed inventories with the same names are picked up. To achieve this, run automation with:

       tags: 
        controller_config_templates_apply 
        controller_config_workflows_apply

    Final thoughts

    While the suggested approach is not fully automated due to the differences between two kinds of inventories, playbooks available in the configify.aapconfig collection allow reducing time and effort required for such migration.

    Stay tuned for the final installment, discussing migration from Ansible Automation Platform version 2.4 to version 2.5. 

    Follow this series:

    • Part 1: The first steps on the path of managing an existing Ansible Automation Platform instance as CaC, setting up Ansible Automation Platform accounts, collections, credentials, projects, and job templates required to run the automation, exporting configuration of some objects, handling secrets and special strings in the CaC, and managing configuration drift.

    • Part 2: Completing the transition: exporting all objects, formatting configurations for readability, verification, access restrictions, and Git management.

    • Part 3: Migrating configurations from AWX 24 to Ansible Automation Platform 2.5.

    • Part 4: Migrating smart inventories (deprecated in future Ansible Automation Platform releases) to constructed inventories.

    • Part 5: Migrating configurations from Ansible Automation Platform 2.4 to Ansible Automation Platform 2.5.

    Last updated: August 29, 2025

    Related Posts

    • How to start configuration as code for an Ansible instance

    • Automating configuration of an existing Ansible instance

    • Migrating a namespace-scoped Operator to a cluster-scoped Operator

    Recent Posts

    • A day in the life of an NVIDIA H100 on Red Hat OpenShift 5

    • Migrate BuildConfigs to builds for Red Hat OpenShift with one plug-in install

    • Run Red Hat Enterprise Linux CoreOS on NVIDIA BlueField DPUs

    • Agent harness engineering: Separating model capabilities from enforcement

    • What's new for developers in Red Hat Enterprise Linux 10.3 and 9.9

    What’s up next?

    Learn the basics of YAML, a simple yet powerful data serialization language, through examples using Ansible.

    Start the activity
    Red Hat Developers logo

    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
    Ask AI