How to retrieve the output and details of the Remote Execution Job using an API call ?

Solution Verified - Updated -

Environment

  • Red Hat Satellite 6.x

Issue

  • How to retrieve the output of the Remote Execution Job using an API call?
  • How to fetch the details of SSH command executed via Remote Job on the host from Red Hat Satellite CLI?

Resolution

  • Execute the below curl command to get the details of all jobs executed by Remote Execution and then fetch the job Id for a job which needs to be explored:
# curl -H "Accept:application/json,version=2" -H "Content-Type:application/json" -X GET -u admin:password https://satellite.example.com/api/job_invocations  --insecure |python -m json.tool|egrep -w "description|id"
  • Execute the below curl command to get the host list on which a particular job is executed by Remote Execution:
# curl -H "Accept:application/json,version=2" -H "Content-Type:application/json" -X GET -u admin:password https://satellite.example.com/api/job_invocations/<job_id> --insecure |python -m json.tool|grep hosts -A5
  • Execute the below curl command to get the output of a particular job executed by Remote Execution:
# curl -H "Accept:application/json,version=2" -H "Content-Type:application/json" -X GET -u admin:password https://satellite.example.com/api/job_invocations/<job_id>/hosts/<host_id> --insecure |python -m json.tool

Note : Change the Red Hat Satellite Server name, user name and password and in all the above commands as per the requirement.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments