spacecmd (1) - Linux Manuals

spacecmd: a command-line interface to Spacewalk and Satellite servers

NAME

spacecmd - a command-line interface to Spacewalk and Satellite servers

SYNOPSIS

spacecmd [options] [command]

OVERVIEW

spacecmd is a command-line interface to Spacewalk and Satellite servers.
It is written in Python and uses the XML-RPC API provided by the server.
Nearly all aspects of the Satellite can be managed by spacecmd.  These
include managing systems, software channels, configuration channels,
activation keys, Kickstarts and users.

spacecmd can be run as an interactive shell by running it without a
command.  It can also run a single command by passing the command
and the required arguments on the command line.

Run 'spacecmd help' to list the actions that are availble.

Run 'spacecmd -- <command> --help' to get help for a particular command.

RUNNING SINGLE COMMANDS

When running spacecmd non-interactively, you must take care to escape
arguments passed to the spacecmd functions.  This involves putting a '--'
before the command starts so that the arguments to the function are not
treated as global arguments to spacecmd.  You must also escape any quotes
that you pass to the functions so that the shell does not interpret them.

Example:
spacecmd -s server1 -- softwarechannel_create -n \'My Channel\' \
                                              -l channel1 \
                                              -a x86_64

OPTIONS

-u USERNAME, --username=USERNAME
use this username to connect to the server
-p PASSWORD, --password=PASSWORD
use this password to connect to the server
-s SERVER, --server=SERVER
connect to this server [default: localhost]
--nossl
use HTTP instead of HTTPS
--nohistory
do not store command history
-y, --yes
answer yes for all questions
-q, --quiet
print only error messages
-d, --debug
print debug messages
-h, --help
show this help message and exit

CONFIGURATION FILES

Configuration files are loaded from /etc/spacecmd.conf and ~/.spacecmd/config.
The default section is [spacecmd].  It can then be overridden with server
specific sections.  Command-line arguments always override options in the
configuration files.

[spacecmd]
server=localhost
username=admin
password=redhat
nossl=0

[satellite.example.com]
username=joe
password=secret
nossl=1

EXAMPLES

Make temporary groups on-the-fly

spacecmd> ssm_add search:driver:bnx2
Systems Selected: 111

spacecmd> ssm_add search:device:vmware
Systems Selected: 285

spacecmd> ssm_add search:hostname:external.example.com
Systems Selected: 16

Add and remove packages from the commandline

[user@sat]$ spacecmd -y system_installpackage www* mod_python
Scheduled 6 system(s)

[user@sat]$ spacecmd -y system_removepackage wiki02 mod_perl
Scheduled 1 system(s)

Schedule reboots from the commandline

[user@sat]$ spacecmd -y -- system_reboot ldap* -s +6h

Start Time: 20160106T07:01:00

Systems
-------
ldap01
ldap02
ldap03

[user@sat]$ spacecmd -y system_reboot www01

Start Time: 20160106T02:01:00

Systems
-------
www01

Apply errata from the command line

[user@sat]$ spacecmd -y errata_apply RHSA-2010:0423
Scheduled 42 system(s)

[user@sat]$ spacecmd -y system_applyerrata group:web_servers RHSA-2010:0040
Scheduled 16 system(s)

Quickly generate reports

spacecmd> system_listerrata ldap03
System: ldap03

Security Errata:
RHSA-2010:0458  Moderate: perl security update                        6/7/10
RHSA-2010:0449  Moderate: rhn-client-tools security update            6/1/10
RHSA-2010:0423  Important: krb5 security update                      5/18/10

spacecmd> report_errata
# Systems       Errata
---------       ------
CLA-2010:0474       88
CLA-2010:0475        6
CLA-2010:0488      183
CLA-2010:0490      273
CLA-2010:0500        4
CLA-2010:0501        5
RHBA-2010:0402       1
RHSA-2010:0474       2
RHSA-2010:0488       1
RHSA-2010:0490       5

spacecmd> report_outofdatesystems
System        Packages
------        --------
monkey             310
shark               63
hedgehog            39
pomeranian           4

spacecmd> report_ipaddresses
System   Hostname                IP
------   --------                --
dns01    dns01.dmz.example.com   192.168.254.53
www01    www01.dmz.example.com   192.168.254.80
ztest    ztest.test.example.com  192.168.42.111

spacecmd> report_kernels
System       Kernel
------       ------
system01     2.6.9-89.0.25.ELsmp
system02     2.6.9-89.0.3.ELsmp
system03     2.6.9-89.0.26.ELsmp

Tab completion of everything

spacecmd> system_installpackage ssm vmware-tools [tab]
vmware-tools         vmware-tools-kmod
vmware-tools-common  vmware-tools-nox

Easily view system information

spacecmd> system_details www01.example.com
Name:          www01.example.com
System ID:     1000010001
Locked:        False
Registered:    20100311 19:31:36
Last Checkin:  20100621 18:31:53
OSA Status:    online

Hostname:      www01.example.com
IP Address:    192.168.1.80
Kernel:        2.6.18-164.el5

Software Channels:
  custom-rhel-i386-server-5
    |-- custom-extras-i386-rhel5
    |-- clone-rhn-tools-rhel-i386-server-5

Configuration Channels:
  sudoers
  base
  base-rhel5

Entitlements:
  Management
  Provisioning

System Groups:
  all_linux_systems
  all_linux_VMs
  rhel5-i386

BUGS

Please report any bugs to https://bugzilla.redhat.com/ under the "spacecmd"
component.

HOMEPAGE

https://fedorahosted.org/spacewalk/wiki/spacecmd

AUTHOR

spacecmd was written by Aron Parsons <aronparsons [at] gmail.com>