How to use awx.awx.job_launch usage

We use Ansible to baseline our Windows VM’s and it’s been working great for several years. However it’s got to a point that we need to branch things out between teams.

I’ve configured a new project, template and linked it to the new team’s GH repo

What I’m trying to configure is a way to launch their job template with the awx.awx.job_launch module and encountering quite a bit of problems. I’m sure I’m missing something simple.

I need to be able to conditionally launch their template and do so with a set of credentials that are also conditional based on the domain it’s going into.

I’ve tried to get this as basic as possible to just prove it out, then can add additional logic once I get the syntax right.

I understand that the module must run on the controller node as attempting to run it against the windows VM being targeted fails because it doesn’t have the Python modules installed. It’s trying to get that figured out where I’m running into issues

If I run this from within my baseline.yml when it goes to delegate_to: localhost, I can see it try to launch on localhost with the machine cred attached to the template and winrm

    - name: Launch downstream job
      delegate_to: localhost
      connection: local
      awx.awx.job_launch:
        job_template: "{{ next_playbook }}"
        limit: "{{ ansible_hostname }}"
        credentials: [202]
      register: job_info

and I’m not sure why that is or how I’m supposed to be configuring this to work the way I need it to.

If a separate out this code into it’s own yml file and template like this and incorporate into a workflow the play skips it because there is no localhost to be found

- hosts: localhost
  gather_facts: false
  connection: local
- name: Launch downstream job
  awx.awx.job_launch:
    job_template: “{{ next_playbook }}”
    limit: “{{ ansible_hostname }}”
    credentials: [202]
  register: job_info

I’m hoping someone can tell me what I’m missing or show me a working example that I can model after.