Inventory sync is failing with "ERROR! No inventory was parsed, please check your configuration and options." error.

Solution Verified - Updated -

Environment

  • Red Hat Ansible Automation Platform 2.x

Issue

  • The inventory sync on the automation controller fails with the error "ERROR! No inventory was parsed, please check your configuration and options" when inventory of hosts in AAP is sourced from ServiceNow.

Resolution

Root Cause

  • This bug was reported in servicenow.itsm 2.5.0 and fixed in servicenow.itsm 2.6 version.

Diagnostic Steps

  • The output of the inventory sync:

    ansible-inventory [core 2.15.4]
    config file = /etc/ansible/ansible.cfg
    configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
    ansible python module location = /usr/lib/python3.9/site-packages/ansible
    ansible collection location = /runner/requirements_collections:/var/lib/awx/.ansible/collections/ansible_collections:/home/runner/.ansible/collections:/usr/share/ansible/collections:/usr/share/automation-controller/collections
    executable location = /usr/bin/ansible-inventory
    python version = 3.9.16 (main, May 31 2023, 12:21:58) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)] 
    (/usr/bin/python3.9)
    jinja version = 3.1.2
    libyaml = True
    Using /etc/ansible/ansible.cfg as config file
    setting up inventory plugins
    Loading collection ansible.builtin from 
    host_list declined parsing /runner/project/inventories/now.yml as it did not pass its verify_file() method
    script declined parsing /runner/project/inventories/now.yml as it did not pass its verify_file() method
    Loading collection servicenow.itsm from /runner/requirements_collections/ansible_collections/servicenow/itsm
    Using inventory plugin 'ansible_collections.servicenow.itsm.plugins.inventory.now' to process inventory source 
    '/runner/project/inventories/now.yml'
    toml declined parsing /runner/project/inventories/now.yml as it did not pass its verify_file() method
    [WARNING]: * Failed to parse /runner/project/inventories/now.yml with auto
    plugin: sequence item 3: expected str instance, AnsibleSequence found
    File "/usr/lib/python3.9/site-packages/ansible/inventory/manager.py", line 293, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
    File "/usr/lib/python3.9/site-packages/ansible/plugins/inventory/auto.py", line 59, in parse
    plugin.parse(inventory, loader, path, cache=cache)
    File "/runner/requirements_collections/ansible_collections/servicenow/itsm/plugins/inventory/now.py", line 529, 
    in parse
    cache_sub_key = "/".join(
    [WARNING]: * Failed to parse /runner/project/inventories/now.yml with yaml
    plugin: Plugin configuration YAML file, not YAML inventory
    File "/usr/lib/python3.9/site-packages/ansible/inventory/manager.py", line 293, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
    File "/usr/lib/python3.9/site-packages/ansible/plugins/inventory/yaml.py", line 114, in parse
    raise AnsibleParserError('Plugin configuration YAML file, not YAML inventory')
    [WARNING]: * Failed to parse /runner/project/inventories/now.yml with ini
    plugin: Invalid host pattern 'plugin:' supplied, ending in ':' is not allowed,
    this character is reserved to provide a port.
    File "/usr/lib/python3.9/site-packages/ansible/inventory/manager.py", line 293, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
    File "/usr/lib/python3.9/site-packages/ansible/plugins/inventory/ini.py", line 137, in parse
    raise AnsibleParserError(e)
    [WARNING]: Unable to parse /runner/project/inventories/now.yml as an inventory
    source
    ERROR! No inventory was parsed, please check your configuration and options.
    

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments