Scripted remote removal of server from Satellite 5
I am looking for a scripted/automated remote method of removing a server from Satellite, basically the reverse of rhnreg_ks
This is to be executed as part of the teardown stage of life cycle management and can either be executed from the host before it is 'torn down' or alternatively can be executed from one of the orchestration servers. In both instances, the servers making the call are 'remote' (ie. not the Satellite server)
Currently I am looking at a using a spacecmd call from either the server or the orchestration infrastructure with an API call using spacecmd:
spacecmd system_delete <hostname>
Can anyone think of a better/more elegant solution?
Is anyone else doing automated removal remotely? (rather than cleaning up unresponsive hosts on the Satellite server itself)
Responses
Hello - the most straightforward and supported way (spacemd is not yet supported as of Satellite 5.6) would be to use the Satellite API such as deleteSystem() or deleteSystems() calls in the systems namespace: https://access.redhat.com/documentation/en-US/Red_Hat_Satellite/5.6/html/API_Overview/chap-system.html - should be a trivial python or perl script to write.
Hope this helps
I do use spacecdmd on satellite 5.6 routinely. I did find that if/when it did fail, I'd have to wait a full hour before doing a deletion again via spacecmd. I'll see if I can find the reference I found that I believe I put someplace in the discussion area a while back.
UPDATE: found some of what I documented (regarding a one-hour delay due to clearing a cache, see this link here at this discussion https://access.redhat.com/discussions/1130053.
Pixel, it appears possible, and I suspect I can have a working example when I dig into it a bit more. I found one API Perl script example I posted here at https://access.redhat.com/discussions/723333 which when altered and matched with https://YOURSATSERVER.fqdn/rhn/apidoc/handlers/SystemHandler.jsp#deleteSystem may prove a valid example when merged properly. Will work in this - must go for the day.
-R Hinton
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
