Add a source to an inventory
Use the following procedure to add a source to an inventory. When you add a source to an inventory, the system creates a new group for that source.
About this task Copy linkLink copied!
Inventory sources are not associated with groups. Spawned groups are top-level and can still have child groups. All of these spawned groups can have hosts. Adding a source to an inventory only applies to standard inventories.
Procedure Copy linkLink copied!
Source from a project’s source control management Copy linkLink copied!
An inventory that is sourced from a project means that it uses the SCM type from the project it is tied to. For example, if the project’s source is from GitHub, then the inventory uses the same source.
About this task Copy linkLink copied!
Use the following procedure to configure a project-sourced inventory:
Procedure Copy linkLink copied!
If you are executing a custom inventory script from SCM, ensure that you set the execution bit (chmod +x) for the script in your upstream source control.
If you do not, automation controller throws a [Error 13] Permission denied error on execution.
Source an inventory from Amazon Web Services EC2 Copy linkLink copied!
Use the following procedure to configure an AWS EC2-sourced inventory.
Procedure Copy linkLink copied!
If you only use include_filters, the AWS plugin always returns all the hosts. To use this correctly, the first condition on the or must be on filters and then build the rest of the OR conditions on a list of include_filters.
Source an inventory from Google Compute Engine Copy linkLink copied!
Learn how to configure a Google-sourced inventory:
Procedure Copy linkLink copied!
- From the navigation panel, select .
- Select the inventory name you want a source to and click the Sources tab.
- Click .
- In the Add new source page, select Google Compute Engine from the Source list.
- The Create source window expands with the required Credential field. Choose from an existing GCE Credential. For more information, see Managing user credentials.
- Optional: You can specify the verbosity, host filter, enabled variables or values, and update options as described in Adding a source.
- Use the Source Variables field to override variables used by the
gcp_computeinventory plugin. Enter variables by using either JSON or YAML syntax. Use the radio button to toggle between the two. For more information about these variables, see the gcp_compute inventory plugin documentation.
Source an inventory from Microsoft Azure resource manager Copy linkLink copied!
Use the following procedure to configure an Microsoft Azure Resource Manager-sourced inventory.
Procedure Copy linkLink copied!
- From the navigation panel, select .
- Select the inventory name you want a source to and click the Sources tab.
- Click .
- In the Create source page, select Microsoft Azure Resource Manager from the Source list.
- Enter the following details in the additional fields:
- Optional: Credential: Choose from an existing Azure Credential. For more information, see Managing user credentials.
- Optional: You can specify the verbosity, host filter, enabled variables or values, and update options as described in Adding a source.
- Use the Source variables field to override variables used by the
azure_rminventory plugin. Enter variables by using either JSON or YAML syntax. Use the radio button to toggle between the two. For more information about these variables, see the azure_rm inventory plugin documentation.
Source an inventory from VMware vCenter Copy linkLink copied!
You can configure automation controller to synchronize inventory from a VMware vCenter server. You can manage virtual machines as part of your automation workflows.
Procedure Copy linkLink copied!
VMWare properties have changed from lower case to camel case. Automation controller provides aliases for the top-level keys, but lower case keys in nested properties have been discontinued.
Source an inventory from VMware ESXi Copy linkLink copied!
Learn how to configure a VMWare ESXi sourced inventory.
Procedure Copy linkLink copied!
VMWare properties have changed from lower case to camel case. Automation controller provides aliases for the top-level keys, but lower case keys in nested properties have been discontinued.
Source an inventory from Red Hat Satellite 6 Copy linkLink copied!
automation controller can integrate with Red Hat Satellite 6 as a dynamic inventory source.
About this task Copy linkLink copied!
Use the following procedure to configure a Red Hat Satellite-sourced inventory.
Procedure Copy linkLink copied!
If you meet an issue with the automation controller inventory not having the "related groups" from Satellite, you might need to define these variables in the inventory source. For more information, see Red Hat Satellite 6.
If you see the message, "no foreman.id" variable(s) when syncing the inventory, see the solution on the Red Hat Customer Portal at: https://access.redhat.com/solutions/5826451. Be sure to login with your customer credentials to access the full article.
Source an inventory from Red Hat Lightspeed Copy linkLink copied!
You can create an inventory source that uses Red Hat Lightspeed as the source of hosts.
About this task Copy linkLink copied!
Use the following procedure to configure a Red Hat Lightspeed-sourced inventory.
Procedure Copy linkLink copied!
Source an inventory from OpenStack Copy linkLink copied!
You can create an inventory source that uses the OpenStack inventory plugin to dynamically generate inventory from your OpenStack cloud.
Procedure Copy linkLink copied!
Source an inventory from Red Hat Virtualization Copy linkLink copied!
Learn how to configure a Red Hat virtualization-sourced inventory.
Procedure Copy linkLink copied!
Source an inventory from Red Hat Ansible Automation Platform Copy linkLink copied!
An inventory that is sourced from Red Hat Ansible Automation Platform uses the Red Hat Ansible Automation Platform inventory plugin to gather inventory data from the Red Hat Ansible Automation Platform platform.
About this task Copy linkLink copied!
Use the following procedure to configure an automation controller-sourced inventory.
Procedure Copy linkLink copied!
Source an inventory from Terraform State Copy linkLink copied!
Use the following procedure to create a Terraform State inventory source.
About this task Copy linkLink copied!
This inventory source uses the terraform_state inventory plugin from the cloud.terraform collection. The plugin parses a terraform state file and add hosts for AWS EC2, GCE, and Microsoft Azure instances.
Procedure Copy linkLink copied!
Source an inventory from OpenShift Virtualization Copy linkLink copied!
Learn how to add an OpenShift Virtualization inventory source to an existing inventory.
Before you begin Copy linkLink copied!
- You need a virtual machine deployed in a specific namespace and an OpenShift or Kubernetes API Bearer Token credential.
About this task Copy linkLink copied!
This inventory source uses a cluster that is able to deploy Red Hat OpenShift Container Platform Virtualization.
Procedure Copy linkLink copied!
Source an inventory from a custom inventory plugin Copy linkLink copied!
This describes how to use the servicenow.itsm collection inventory plugin to sync inventory on Ansible Automation Platform.
Procedure Copy linkLink copied!
Export old inventory scripts Copy linkLink copied!
Despite the removal of the custom inventory scripts API, the scripts are still saved in the database.
To recover the scripts from the database in a format that is suitable for you to check into source control, use the following command:
$ awx-manage export_custom_scripts --filename=my_scripts.tar
Dump of old custom inventory scripts at my_scripts.tar
Making use of the output:
$ mkdir my_scripts
$ tar -xf my_scripts.tar -C my_scripts
The name of the scripts has the form: <pk>_<name>. This is the naming scheme used for project folders.
$ ls my_scripts
10inventory_script_rawhook _19 _30inventory_script_listenhospital
_11inventory_script_upperorder _1inventory_script_commercialinternet45 _4inventory_script_whitestring
_12inventory_script_eastplant _22inventory_script_pinexchange _5inventory_script_literaturepossession
_13inventory_script_governmentculture _23inventory_script_brainluck _6inventory_script_opportunitytelephone
_14inventory_script_bottomguess _25inventory_script_buyerleague _7inventory_script_letjury
_15inventory_script_wallisland _26inventory_script_lifesport _8random_inventory_script
16inventory_script_wallisland _27inventory_script_exchangesomewhere _9random_inventory_script
_17inventory_script_bidstory _28inventory_script_boxchild
_18p _29__inventory_script_wearstress
Each file contains a script. Scripts can be bash/python/ruby/more, so the extension is not included. They are all directly executable. Executing the script dumps the inventory data.
$ ./my_scripts/11__inventory_script_upperorder
{"group\ud801\udcb0\uc20e\u7b0e\ud81c\udfeb\ub12b\ub4d0\u9ac6\ud81e\udf07\u6ff9\uc17b": {"hosts":
["host_\ud821\udcad\u68b6\u7a51\u93b4\u69cf\uc3c2\ud81f\uddbe\ud820\udc92\u3143\u62c7",
"host_\u6057\u3985\u1f60\ufefb\u1b22\ubd2d\ua90c\ud81a\udc69\u1344\u9d15",
"host_\u78a0\ud820\udef3\u925e\u69da\ua549\ud80c\ude7e\ud81e\udc91\ud808\uddd1\u57d6\ud801\ude57",
"host_\ud83a\udc2d\ud7f7\ua18a\u779a\ud800\udf8b\u7903\ud820\udead\u4154\ud808\ude15\u9711",
"host_\u18a1\u9d6f\u08ac\u74c2\u54e2\u740e\u5f02\ud81d\uddee\ufbd6\u4506"], "vars": {"ansible_host": "127.0.0.1", "ansible_connection":
"local"}}}
You can verify functionality with ansible-inventory. This gives the same data, but reformatted.
$ ansible-inventory -i ./my_scripts/_11__inventory_script_upperorder --list --export
In the preceding example, you can cd into my_scripts and then issue a git init command, add the scripts you want, push it to source control, and then create an SCM inventory source in the user interface.
For more information about syncing or using custom inventory scripts, seeImport your inventory file from source control in Configuring automation execution.

