xebialabs-community / xlr-ansible-tower-plugin

Launch Ansible Tower Jobs from XL Release
MIT License
1 stars 8 forks source link

fr: provide job_tags via Ansible job template task #11

Open ltutar opened 3 years ago

ltutar commented 3 years ago

Hi,

{"inventory_id":2,"credentials":[3,11],"job_type":"run","limit":"","job_tags":"levent","skip_tags":"","extra_vars":{"git_access_protocol":"https","git_clone_url":"egypt.intern/cdaas/cdaas-demo-app.git","git_project_access_name":"cdaas-demo-app","git_project_access_token":"$encrypted$","test_directory":"/tmp/cypress","git_repository_name":"cdaas-demo-app"},"scm_branch":""}

job_tags is not part extra_vars. I would like to provide the job_tags via job template task.

Screenshot 2021-01-25 at 13 41 23
Th3Heavy commented 1 year ago

up, need to use tags too

jeremydelmotte commented 1 year ago

Hi guys,

You can add this in your "src/main/resources/synthetic.xml" in the "launch.Job" task => <property name="job_tags" category="input" kind="string" required="false" description="The tags to run" />

Then you add this in the "src/main/jython/run_job_template.py" =>

if task_vars['jobtags']: vars = str(task_vars['job_tags']) print("* set jobtags : {0}".format(vars)) k_vars['jobtags'] = vars

In my case, it works, I can now give Ansible Tower the tags to be run.

Hope I understand your use case.

Regards,

Jeremy