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

Expand COLLECTIONS_PATHS for repos that are a valid collection #14174

Open azrdev opened 1 year ago

azrdev commented 1 year ago

Please confirm the following

Feature type

New Feature

Feature Summary

When a repo (referenced by an AWX project) is itself a collection, it should be possible to reference e.g. its contained playbooks by fqcn (docs) instead of (relative) path, in import_playbook, and also in the Job Template Add/Edit GUI. The same is probably true for roles (and much more common). This currently does not work, because the project directory is not added to the ansible config value COLLECTIONS_PATHS.

Select the relevant components

Steps to reproduce

  1. Create a collection example.test
  2. Create two playbooks in a directory playbooks/:
    # one.yml
    - import_playbook: example.test.two

    and two.yml

  3. Commit the (collection directory) to git, so that there is /path/to/ansible_collections/example/test/.git/
  4. Add the repo as a Project in AWX
  5. Try to create a JT from that Project with Playbook = example.test.one
  6. Create & Launch a JT from that Project with Playbook = playbooks/one.yml

Current results

  1. Cannot create a JT with a FQCN, only a path
  2. import_playbook cannot find two.yml by FQCN

Sugested feature result

I propose to add the project directory to the ansible config value COLLECTIONS_PATHS when a project is recognized to be a collection, e.g. when containing a galaxy.yml at the toplevel (with yaml keys matching the expected schema).

Additional information

Maybe split the GUI issue about JT.playbook ?

azrdev commented 5 months ago

The part "When a repo (referenced by an AWX project) is itself a collection, it should be possible to reference e.g. its contained playbooks by fqcn [...] in the Job Template Add/Edit GUI" is #14124