ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
14.06k stars 3.42k forks source link

Importing an inventory sourced from a manual project fails #15475

Closed jean-christophe-manciot closed 22 hours ago

jean-christophe-manciot commented 2 months ago

Please confirm the following

Bug Summary

As a workaround to the already reported issue Source From A Project Doesn't Show Any Inventory, I used to be able to import inventories sourced from manual projects with the command awx-manage inventory_import run from within the tools_awx_1 container. With AWX 24.6.0, this command now fails.

AWX version

24.6.0

Select the relevant components

Installation method

docker development environment

Modifications

no

Ansible version

2.17.3

Operating system

Ubuntu 24.04 noble

Web browser

No response

Steps to reproduce

Expected results

Successful Import of all inventories sourced from the manual projects

Actual results

sh-5.1# awx-manage inventory_import --inventory-name Inventory-1 --source /var/lib/awx/projects/git-Inventory-1/ --overwrite --overwrite-vars
    2.358 INFO     Updating inventory 2: Inventory-1
2024-08-28 14:05:21,641 INFO     [-] awx.analytics.job_lifecycle inventoryupdate-25 created {"type": "inventoryupdate", "task_id": 25, "state": "created", "work_unit_id": null, "task_name": "Inventory-1 -  (Inventory-1 - 25)"}
    2.476 INFO     Reading Ansible inventory source: /var/lib/awx/projects/git-Inventory-1
Traceback (most recent call last):
  File "/usr/local/bin/awx-manage", line 18, in <module>
    load_entry_point('awx', 'console_scripts', 'awx-manage')()
  File "/awx_devel/awx/__init__.py", line 177, in manage
    execute_from_command_line(sys.argv)
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/awx_devel/awx/main/management/commands/inventory_import.py", line 896, in handle
    data = AnsibleInventory-1Loader(source=source, verbosity=verbosity).load()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/awx_devel/awx/main/management/commands/inventory_import.py", line 132, in load
    return self.command_to_json(base_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/awx_devel/awx/main/management/commands/inventory_import.py", line 116, in command_to_json
    raise RuntimeError('%s failed (rc=%d) with stdout:\n%s\nstderr:\n%s' % ('ansible-inventory', proc.returncode, stdout, stderr))
RuntimeError: ansible-inventory failed (rc=127) with stdout:

stderr:
Error: crun: writing file `/sys/fs/cgroup/libpod_parent/libpod-4ccd4c5a4e1c85d9328a135745860ec898efe81e4a4548a0bbc279935aed7191/cgroup.procs`: No such file or directory: OCI runtime attempted to invoke a command that was not found

sh-5.1# ls -al /var/lib/awx/projects/git-Inventory-1
total 36
drwxr-x---  4 root root  4096 Aug 28 12:53 .
drwxr-x--- 19 root root  4096 Feb 27  2024 ..
drwxr-x--- 66 root root  4096 Aug 27 15:29 group_vars
-rw-r-----  1 root root 20321 Aug 27 15:29 hosts
drwxr-x--- 14 root root  4096 Aug 27 15:29 host_vars

Additional information

No response

GitGorgon commented 2 months ago

When you see problems like this you realise the developers care absolutely nothing about making AWX usable

No doubt all the devs are workign on this: https://github.com/ansible/awx/issues/13737 "Improvements to the AWX development experience](https://github.com/ansible/awx/issues/13737"

The "development" experience is super-important of course, but the user experience? Nah. Devs do not care one tiny little jot about that.

Incredible isn't it, to think that I can pass ansible a folder with '-i /path/to/folder', and ansible will parse that in a second and make full use of it...

But after years of development, useless "smart inventories", absurd requirements to use awx-manage, and the issue 'Cannot use manual project for SCM-based inventory' - that prevents us from using awx.awx.inventory_source module with manual projects as "source" - now, smart inventories are deprecated as well as being useless. And now we have "constructed inventories"... and yet, AWX cannot simply import an inventory from a file like Ansible cmdline can.

The stupidity, and the contempt for users is mind-boggling.

jean-christophe-manciot commented 22 hours ago

This issue is a duplicate of this thread.