Unable to execute playbook via ansible-runner in an executable environment: Inventory Parsing failed

ShanDesai
Fri, 15 Mar 2024 10:58:40 +0000
Get Help

Project structure

.
├── README.md
├── ansible.cfg
├── appstack
├── artifacts
├── env
├── inventory
├── project
└── tests

my inventory is just a simple localhost setting:

all:
  children:
    ungrouped:
      hosts:
        localhost:

and a host_vars directory:

inventory/host_vars/localhost.yml

which has the following information:

ansible_host: 127.0.0.1
ansible_connection: local

I have downloaded the ghcr.io/ansible-community/community-ee-base:latest image to try out the Process Execution logic with the following command:

ansible-runner . \
--process-isolation \
--process-isolation-executable=docker \
--container-image=ghcr.io/ansible-community/community-ee-base:latest \
-p stack_generate.yml -vvv

This throws out the following error while trying to parse the inventory:

ansible-playbook [core 2.16.1]
  config file = /runner/ansible.cfg
  configured module search path = ['/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.12/site-packages/ansible
  ansible collection location = /runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.12.0 (main, Oct  2 2023, 00:00:00) [GCC 13.2.1 20230918 (Red Hat 13.2.1-3)] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
Using /runner/ansible.cfg as config file
host_list declined parsing /runner/inventory/hosts as it did not pass its verify_file() method
script declined parsing /runner/inventory/hosts as it did not pass its verify_file() method
auto declined parsing /runner/inventory/hosts as it did not pass its verify_file() method
Parsed /runner/inventory/hosts inventory source with yaml plugin
redirecting (type: callback) ansible.builtin.yaml to community.general.yaml
ERROR! Unexpected Exception, this is probably a bug: type 'NoneType' is not an acceptable base type
the full traceback was:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/ansible/cli/__init__.py", line 659, in cli_executor
    exit_code = cli.run()
                ^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ansible/cli/playbook.py", line 156, in run
    results = pbex.run()
              ^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ansible/executor/playbook_executor.py", line 119, in run
    self._tqm.load_callbacks()
  File "/usr/local/lib/python3.12/site-packages/ansible/executor/task_queue_manager.py", line 200, in load_callbacks
    self._stdout_callback = callback_loader.get(self._stdout_callback)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ansible/plugins/loader.py", line 864, in get
    return self.get_with_context(name, *args, **kwargs).object
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ansible/plugins/loader.py", line 899, in get_with_context
    self._module_cache[path] = self._load_module_source(resolved_type_name, path)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ansible/plugins/loader.py", line 837, in _load_module_source
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 994, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/runner/artifacts/f92e5701-a06c-4931-b849-504ab81812df/callback/awx_display.py", line 316, in <module>
    class CallbackModule(DefaultCallbackModule):
TypeError: type 'NoneType' is not an acceptable base type

locally ansible-inventory -i inventory --list infact parses the correct inventory.

Why is it failing to parse the inventory in the container?

5 posts - 3 participants