I tried to launch a Job from a Job template by calling Ansible Tower API. Took a test on PostMan, turns out the http://ansibletowerhost/api/v2/job_templates/8/launch/ with POST cannot work correctly.
Here 8 is the job template id, which is a simple test job template. The document says the result should be like below, and there will be a job record created on Tower.
{
"ignored_fields": {
"credential": 2,
"job_tags": "setup,teardown"
}
"id": 4,
...more data about the job...
"job": 4,
}
But what I got is like this,
{
“can_start_without_user_input”: true,
“passwords_needed_to_start”: ,
“ask_variables_on_launch”: false,
“ask_tags_on_launch”: false,
“ask_diff_mode_on_launch”: false,
“ask_skip_tags_on_launch”: false,
“ask_job_type_on_launch”: false,
“ask_limit_on_launch”: false,
“ask_verbosity_on_launch”: false,
“ask_inventory_on_launch”: false,
“ask_credential_on_launch”: false,
“survey_enabled”: false,
“variables_needed_to_start”: ,
“credential_needed_to_start”: false,
“inventory_needed_to_start”: false,
“job_template_data”: {
“id”: 8,
“description”: “”,
“name”: “simpletest”
},
“defaults”: {
“extra_credentials”: ,
“credential”: {
“id”: 1,
“name”: “Demo Credential”
},
“job_tags”: “”,
“extra_vars”: “”,
“verbosity”: 0,
“job_type”: “run”,
“diff_mode”: false,
“skip_tags”: “”,
“limit”: “”,
“inventory”: {
“id”: 1,
“name”: “Demo Inventory”
},
“vault_credential”: {
“id”: null,
“name”: null
}
}
}
Any idea what goes wrong here?
Thanks.