How to export a list of content host with operating system from Red Hat Satellite 6 server.

Solution Verified - Updated -

Environment

  • Red Hat Satellite 6.2

Issue

  • How to export a list of the content host with the operating system from Red Hat Satellite 6 server.
  • Is it possible to get an export from Red Hat Satellite 6 server, containing the server and OS version? If so, how?

Resolution

  • User can use API call with curl to fetch the required information from the Red Hat Satellite 6 server.
# curl -k -u <Admin Username>:<Password> -X GET https://<Satellite Server FQDN>/api/v2/hosts |json_reformat | grep -Ew 'name|operatingsystem_name' |grep ','$|sed -e 's/operatingsystem_name/operatingsystem/' |sed -e "/name/a\ "
  • The above command only reports the first 20 results as this is a default behavior of Red Hat Satellite 6 server.
  • To view all available systems, use '?per_page=Count' at the end of the API url.

  • For example, to view a thousand systems in single view -

# curl -k -u <Admin Username>:<Password> -X GET https://<Satellite Server FQDN>/api/v2/hosts?per_page=1000 |json_reformat | grep -Ew 'name|operatingsystem_name' |grep ','$|sed -e 's/operatingsystem_name/operatingsystem/' |sed -e "/name/a\ "

Diagnostic Steps

  • The curl command will report the output similar to the following output.
            "operatingsystem": "RedHat 7.2",
            "name": "puppet.example.com",

            "operatingsystem": "RedHat 7.2",
            "name": "system1.example.com",

            "operatingsystem": "RedHat 7.2",
            "name": "system2.example.com",

            "operatingsystem": "RedHat 7.1",
            "name": "system3.example.com",

            "operatingsystem": "RedHat 7.1",
            "name": "system4.example.com",

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