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
13.66k stars 3.37k forks source link

Ability to run playbooks in an EE collection without associated project #14124

Open AlanCoding opened 1 year ago

AlanCoding commented 1 year ago

Please confirm the following

Feature type

New Feature

Feature Summary

There is a feature in Ansible-core to run a playbook that exists inside of a collection:

https://docs.ansible.com/ansible/latest/collections_guide/collections_using_playbooks.html#using-a-playbook-from-a-collection

This is an issue to gain feature-parity with this ability in AWX.

Specifying a playbook inside of a collection, inside of an execution environment, can be done by the FQCN name of the playbook, as explained in the linked docs.

This would replace what is now provided by the job template fields project and playbook fields. Whether a new field may be introduced, or existing fields abused for this purpose is left as an issue for implementation.

Select the relevant components

Steps to reproduce

Run on Ansible CLI

ansible-playbook my_namespace.my_collection.playbook1 -i ./myinventory

Try to do same thing in AWX

Current results

Can't do it.

Sugested feature result

Ability to run playbook defined by FQCN my_namespace.my_collection.playbook1, as an example.

Additional information

Implementation could go in many different directions:

This is related to the existing issues https://github.com/ansible/awx/issues/3780 and https://github.com/ansible/awx/issues/3776. While 3780 would provide something similar via a different content mechanism, and 3776 is old, vague, generally unclear, and doesn't necessarily ask for this RFE.

sean-m-sullivan commented 1 year ago

we have had hit or miss on doing this inside the redhat_cop playbooks, as customers seem to think it is the ONLY way to use the collection/roles, but that is more on the feature and customer assumptions, would love for this ability in AWX

matburt commented 1 year ago

This is similar to something I did here, which made the project optional on jt definition: https://github.com/ansible/awx/pull/12250

Which I think may be the right way to go.

AlanCoding commented 1 year ago

If you use a null project, that means the user would manually type in the FQCN for the playbook. That should work, but it is in-congruent with the current user experience which offers a drop-down selection of playbooks.

I've argued that not collecting metadata for EEs is a problem, see https://github.com/ansible/awx/issues/10409

If we collected the EE metadata then we could populated a suggested playbook list after the user selects the JT execution_environment. Normally this is optional (as it falls back to default), but that brings up a good point - that perhaps we should require an explicit EE on the JT to use this feature. Just a thought.

thenets commented 1 year ago

hey! :D that's nice! I would love to have this feature. I was talking to @relrod and I already this problem.

jon-nfc commented 4 months ago

+1 for this feature.

my two cents.

specifying the fqcn in the playbook fields could be parsed with regex ![\.yml|\.yaml]$ this along with either an additional check box ( is collection ) or using the project field with a unique (i.e. __collection[-1.0.0]) value could be enough to tell AWX it's a collection project.