1spacecmd(1) spacecmd(1)
2
3
4
6 spacecmd - a command-line interface to Spacewalk and Satellite servers
7
9 spacecmd [options] [command]
10
12 spacecmd is a command-line interface to Spacewalk and Satellite servers.
13 It is written in Python and uses the XML-RPC API provided by the server.
14 Nearly all aspects of the Satellite can be managed by spacecmd. These
15 include managing systems, software channels, configuration channels,
16 activation keys, Kickstarts and users.
17
18 spacecmd can be run as an interactive shell by running it without a
19 command. It can also run a single command by passing the command
20 and the required arguments on the command line.
21
22 Run 'spacecmd help' to list the actions that are availble.
23
24 Run 'spacecmd -- <command> --help' to get help for a particular command.
25
27 When running spacecmd non-interactively, you must take care to escape
28 arguments passed to the spacecmd functions. This involves putting a '--'
29 before the command starts so that the arguments to the function are not
30 treated as global arguments to spacecmd. You must also escape any quotes
31 that you pass to the functions so that the shell does not interpret them.
32
33 Example:
34 spacecmd -s server1 -- softwarechannel_create -n \'My Channel\' \
35 -l channel1 \
36 -a x86_64
37
39 -u USERNAME, --username=USERNAME
40 use this username to connect to the server
41
42 -p PASSWORD, --password=PASSWORD
43 use this password to connect to the server
44
45 -s SERVER, --server=SERVER
46 connect to this server [default: localhost]
47
48 --nossl
49 use HTTP instead of HTTPS
50
51 --nohistory
52 do not store command history
53
54 -y, --yes
55 answer yes for all questions
56
57 -q, --quiet
58 print only error messages
59
60 -d, --debug
61 print debug messages
62
63 -h, --help
64 show this help message and exit
65
67 Configuration files are loaded from /etc/spacecmd.conf and ~/.spacecmd/config.
68 The default section is [spacecmd]. It can then be overridden with server
69 specific sections. Command-line arguments always override options in the
70 configuration files.
71
72 [spacecmd]
73 server=localhost
74 username=admin
75 password=redhat
76 nossl=0
77
78 [satellite.example.com]
79 username=joe
80 password=secret
81 nossl=1
82
84 Make temporary groups on-the-fly
85 spacecmd> ssm_add search:driver:bnx2
86 Systems Selected: 111
87
88 spacecmd> ssm_add search:device:vmware
89 Systems Selected: 285
90
91 spacecmd> ssm_add search:hostname:external.example.com
92 Systems Selected: 16
93
94
95 Add and remove packages from the commandline
96 [user@sat]$ spacecmd -y system_installpackage www* mod_python
97 Scheduled 6 system(s)
98
99 [user@sat]$ spacecmd -y system_removepackage wiki02 mod_perl
100 Scheduled 1 system(s)
101
102
103 Schedule reboots from the commandline
104 [user@sat]$ spacecmd -y -- system_reboot ldap* -s +6h
105
106 Start Time: 20160106T07:01:00
107
108 Systems
109 -------
110 ldap01
111 ldap02
112 ldap03
113
114 [user@sat]$ spacecmd -y system_reboot www01
115
116 Start Time: 20160106T02:01:00
117
118 Systems
119 -------
120 www01
121
122
123
124 Apply errata from the command line
125 [user@sat]$ spacecmd -y errata_apply RHSA-2010:0423
126 Scheduled 42 system(s)
127
128 [user@sat]$ spacecmd -y system_applyerrata group:web_servers RHSA-2010:0040
129 Scheduled 16 system(s)
130
131
132 Quickly generate reports
133 spacecmd> system_listerrata ldap03
134 System: ldap03
135
136 Security Errata:
137 RHSA-2010:0458 Moderate: perl security update 6/7/10
138 RHSA-2010:0449 Moderate: rhn-client-tools security update 6/1/10
139 RHSA-2010:0423 Important: krb5 security update 5/18/10
140
141 spacecmd> report_errata
142 # Systems Errata
143 --------- ------
144 CLA-2010:0474 88
145 CLA-2010:0475 6
146 CLA-2010:0488 183
147 CLA-2010:0490 273
148 CLA-2010:0500 4
149 CLA-2010:0501 5
150 RHBA-2010:0402 1
151 RHSA-2010:0474 2
152 RHSA-2010:0488 1
153 RHSA-2010:0490 5
154
155 spacecmd> report_outofdatesystems
156 System Packages
157 ------ --------
158 monkey 310
159 shark 63
160 hedgehog 39
161 pomeranian 4
162
163 spacecmd> report_ipaddresses
164 System Hostname IP
165 ------ -------- --
166 dns01 dns01.dmz.example.com 192.168.254.53
167 www01 www01.dmz.example.com 192.168.254.80
168 ztest ztest.test.example.com 192.168.42.111
169
170 spacecmd> report_kernels
171 System Kernel
172 ------ ------
173 system01 2.6.9-89.0.25.ELsmp
174 system02 2.6.9-89.0.3.ELsmp
175 system03 2.6.9-89.0.26.ELsmp
176
177
178 Tab completion of everything
179 spacecmd> system_installpackage ssm vmware-tools [tab]
180 vmware-tools vmware-tools-kmod
181 vmware-tools-common vmware-tools-nox
182
183
184 Easily view system information
185 spacecmd> system_details www01.example.com
186 Name: www01.example.com
187 System ID: 1000010001
188 Locked: False
189 Registered: 20100311 19:31:36
190 Last Checkin: 20100621 18:31:53
191 OSA Status: online
192
193 Hostname: www01.example.com
194 IP Address: 192.168.1.80
195 Kernel: 2.6.18-164.el5
196
197 Software Channels:
198 custom-rhel-i386-server-5
199 |-- custom-extras-i386-rhel5
200 |-- clone-rhn-tools-rhel-i386-server-5
201
202 Configuration Channels:
203 sudoers
204 base
205 base-rhel5
206
207 Entitlements:
208 Management
209 Provisioning
210
211 System Groups:
212 all_linux_systems
213 all_linux_VMs
214 rhel5-i386
215
217 Please report any bugs to https://bugzilla.redhat.com/ under the "spacecmd"
218 component.
219
221 https://github.com/spacewalkproject/spacewalk/wiki/spacecmd
222
224 spacecmd was written by Aron Parsons <aronparsons@gmail.com>
225
226
227
228Aron Parsons spacecmd(1)