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.11k stars 3.43k forks source link

Inventory sync from ini file in git repo/project fails when submodules are tracked #14687

Open fuggla opened 1 year ago

fuggla commented 1 year ago

Please confirm the following

Bug Summary

Syncing an inventory from a git project fails, if the git submodules are tracked. The project itself syncs regardless if submodule tracking is enabled or disabled. The problem is only the inventory source job.

Example repo/project containing an inventory file and a submodule. The parse of inventory.ini fails if the submodule is tracked.

AWX version

2.7.2

Select the relevant components

Installation method

kubernetes

Modifications

no

Ansible version

ansible [core 2.15.4]

Operating system

AlmaLinux 9.3

Web browser

Firefox

Steps to reproduce

  1. create a git repository
  2. add a inventory ini
  3. add a submodule to the repository
  4. add the repository as a project in AWX
  5. Enable track submodules
  6. Create a new inventory
  7. add the inventory ini from the project as a source
  8. sync

Expected results

Hosts from the file should be added to the AWX inventory.

Actual results

The sync fails.

Additional information

Output from job:

Previous Task Failed: {"job_type": "project_update", "job_name": "USERNAME/REPO @ inventory-tests", "job_id": "993"}

Traceback (most recent call last):
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/tasks/jobs.py", line 500, in run
    self.build_project_dir(self.instance, private_data_dir)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/tasks/jobs.py", line 1634, in build_project_dir
    self.sync_and_copy(source_project, private_data_dir, scm_branch=inventory_update.inventory_source.scm_branch)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/tasks/jobs.py", line 791, in sync_and_copy
    return self.sync_and_copy_without_lock(project, private_data_dir, scm_branch=scm_branch)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/tasks/jobs.py", line 747, in sync_and_copy_without_lock
    sync_task.run(local_project_sync.id)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/tasks/jobs.py", line 94, in _wrapped
    return f(self, *args, **kwargs)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/tasks/signals.py", line 81, in _wrapped
    return f(*args, **kwargs)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/tasks/jobs.py", line 665, in run
    raise AwxTaskError.TaskError(self.instance, rc)
Exception: project_update 993 (failed) encountered an error (rc=None), please see task stdout for details.
jessicamack commented 1 year ago

Hello, can you set up a public project repo for us to try out this set up? This will ease troubleshooting.

fuggla commented 1 year ago

Thanks for looking into this. I've setup two public repos. Ansible_base with the ansible_role as a submodule. Ansible_base contains a hosts.ini with IP 1.2.3.4

michten-atos commented 7 months ago

We have the same issue with sourcing inventory from submodules in AAP2.3 @AlanCoding According to: https://github.com/ansible/awx/issues/7900 https://github.com/ansible/awx/issues/5248 https://github.com/ansible/awx/pull/12356 this supposed to be fixed.

utoplenick commented 6 days ago

Having same issue AWX 24.6.2

rommanio commented 5 days ago

Same issue