I tried to launch a Workflow Template on Ansible Tower by calling the APIs. But cannot even get the template information using https://towerIP/api/v2/job_templates/workflowtemplatename. Not mention to launch it. It works fine with those Job Templates. Does anyone know why it cannot work? Or did I just misuse it?
Just gonna add a bit of extra info to what’s already been said - Workflow Job Templates and Job Templates are returned jointly via /api/v2/unified_job_templates but they each have their own endpoints (/api/v2/job_templates and /api/v2/workflow_job_templates). To launch a workflow via the api you’ll need to hit /api/v2/workflow_job_templates/N/launch/ where N is the id of the workflow job template.
However, you can use its named url. To do this, navigate to its detail view (like the prior link) and see the entry “named_url” under “related”.
In my case, I named my WFJT “asdf”, but it exists in the “Default” organization.
Names are only unique within a single organization, thus the named URL is a combination of both names.
Thus, the named URL for my WFJT looks like: http://tower.invalid/api/v2/workflow_job_templates/asdf++Default/
Yes, exactly what I need. Don’t quite understand what you mean. There are definitely similar demands in practice. For my case, I need to drive a 3rd party platform by calling its APIs using URI module. And need to provide payload based on the user’s input each time. What will you do in this case?
Yes, exactly what I need. Don't quite understand what you mean. There are
definitely similar demands in practice. For my case, I need to drive a 3rd
party platform by calling its APIs using URI module. And need to provide
payload based on the user's input each time. What will you do in this case?
I mean it's not a feature that's supported. There is no way to pass, at
launch time, variables for inidividual workflow components.
extra_vars can be passed to the workflow as a whole; those extra vars passed
to the workflow are passed to all job templates in the workflow.