How to change the content source for a host using the API or `hammer`?

Solution In Progress - Updated -

Environment

  • Red Hat Satellite 6

Issue

  • How to view or change the content source of one or more hosts using the API or hammer command line?

Resolution

  • Run the below command on Satellite 6.3 and above to set content_source_id using hammer.

    # hammer -u admin -p XXXXX host update  --help | grep -i content-source
    
    # hammer -u admin -p XXXXX host update --id <content host id> --content-source-id <CAPSULE_ID>
    
  • Satellite 6.2 does not have the above feature, below workaround works

  • Run the below API command on Satellite v 6.2.12 to set content_source_id via command line.

    # curl -H "Content-Type:application/json" -X PUT -u 'username:password' -k -d '{"host":{"content_source_id": "2"}}'  https://satellite.example.com/api/v2/hosts/123
    
  • Replace the following in the above curl request as:

    • 123 --> with the host ID for which content source ID needs to be updated.
    • satellite.example.com --> with FQDN of the satellite server
    • username:password --> with appropriate admin user credentials
    • "2" (content_source_id) --> with appropriate capsule server ID

NOTE : This feature is planned to be made available on web ui from Satellite 6.12

Root Cause

  • The content source of a host can be changed using the API but cannot be set via hammer command.
  • The content source of a host cannot currently be queried nor changed using hammer.

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