Lead Image © NASA

Lead Image © NASA

Managing Linux systems with Spacewalk

Ground Control

Article from ADMIN 17/2013
By
The Spacewalk server provides a comprehensive framework for managing Linux systems, and if you need to automate tasks, the XML-RPC-based API and the spacecmd tool are useful aids. We compare the two variants.

The Spacewalk management framework has been featured in a previous ADMIN issue [1]; so, in this article, I will depart from the familiar web interface and instead show script-based solutions for handling tasks. The Spacewalk API offers a very comprehensive approach to performing every imaginable task on the server. However, admins do need to design fairly complex script constructs when it comes to handling extensive tasks on the server. The language you use for this purpose is not initially important, as long as it supports XML-RPC calls. What you will mostly find here is Perl and Python scripts.

The spacecmd tool also relies on the Spacewalk server's XML-RPC-based API, but it abstracts its calls in handy options. The tool is either started in interactive mode and then waits for your instructions, or you can pass all the necessary options in at the command line. Thus, you can use the tool in your own Bash scripts. Some admins prefer to use Bash rather than a mile-long Python or Perl program. In this article, I compare and contrast the two variants.

Spacewalk API

Typically, any script that wants to talk to the Spacewalk API requires a client and a session object. The session object is used for authentication against the server and must be specified for each method call. To avoid the need to specify username and password for accessing the server in every single script, it makes sense to write a module and integrate this into your scripts.

Listing 1 shows an example of such a module for the Perl scripting language. You need to save the module either in the folder with the API scripts or preferably in the directory with your Perl modules. A call to perl -V shows you where this is. The module requires an

...
Use Express-Checkout link below to read the full article (PDF).

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Spacewalk 2.0 Released
  • Landscape
    Manually maintaining large IT infrastructures almost inevitably leads to errors. Enter Canonical's Landscape, a commercial tool that uses a web interface and an API to gather information, render it graphically, and complete maintenance work.
  • Dispatches from the world of IT
  • All for Admins
    Our Admin special edition was so popular we're back, with a new quarterly magazine that is all for admins. Welcome to the first issue of Admin: Network and Security – a magazine for administrators of heterogenous networks.
  • Protecting the production environment
    Puppet, the ancient rock of configuration management, is not easy to learn, but the program rewards admins with flexibility and security for those willing to tackle the learning curve.
comments powered by Disqus