Ansible tower API: pass inventory_name for a job in a POST payload

93 views Asked by At

Please tell me how to specify the inventory name instead of id when running the template via Tower API?

Work:

curl -k -X POST -H "Content-Type: application/json" -H "Authorization: Bearer aDFNLAKJDFLKXZDnbmz" -d '{"extra_vars":{"app":"pypypy","operation":"show"},"inventory_id":"123"}' https://localhost/api/v2/job_templates/200/launch/

Not work:

curl -k -X POST -H "Content-Type: application/json" -H "Authorization: Bearer aDFNLAKJDFLKXZDnbmz" -d '{"extra_vars":{"app":"pypypy","operation":"show"},"inventory":"inventory_name"}' https://localhost/api/v2/job_templates/200/launch/

Error:

{
  "inventory": [
    "Incorrect type. Expected pk value, received str."
  ]
}
0

There are 0 answers