Red Hat Training

A Red Hat training course is available for Red Hat Satellite

4.4. Red Hat Satellite コマンドラインツール (spacecmd) の使用

spacecmd ツールは Red Hat Satellite の XML-RPC API と対話します。このツールにより、ユーザーはコマンドラインから簡単に Satellite の機能を実行できます。

注記

spacecmd の最初の実行時にユーザー名とパスワードが必要になります。これにより、指定ユーザーのセッションチケットが発行され、その後 spacecmd が使用されると 1 時間後に期限切れになるまでこのセッションが使用されます。ユーザーとパスワードを変更するには、-u USERNAME および -p PASSWORD オプションを使用します。
spacecmd は 2 つの実行方法を使用します。

インタラクティブシェルの使用

spacecmd のみを実行してインタラクティブシェルを開始します。
[root@satellite57 ~]# spacecmd
Welcome to spacecmd, a command-line interface to Spacewalk.

Type: 'help' for a list of commands
      'help <cmd>' for command-specific help
      'quit' to quit

INFO: Connected to https://localhost/rpc/api as admin
spacecmd {SSM:0}>
spacecmd プロンプトが表示され、System Set Manager (SSM) に接続するシステムの数も表示されます。
コマンドを実行するにはシェルに入力します。たとえば、すべてのシステムを一覧表示するには、以下のように system_list を実行します。
spacecmd {SSM:0}> system_list
system001.example.com
system002.example.com
system003.example.com
system004.example.com
...
システムのベースチャンネルを一覧表示するには、system_list の後にシステム名を追加して実行します。
spacecmd {SSM:0}> system_listbasechannel system001.example.com
rhel-x86_64-server-6
help コマンドを使用してすべてのコマンドを一覧表示します。

ターミナルの使用

Linux ターミナルから直接 spacecmd コマンドを実行します。たとえば、spacecmd system_list を使用すると、すべてのシステムが表示されます。
[root@satellite57 ~]# spacecmd system_list
INFO: Connected to https://localhost/rpc/api as admin
system001.example.com
system002.example.com
system003.example.com
system004.example.com
...
また、spacecmd system_listbasechannel systemname を使用するとシステムのベースチャンネルが表示されます。
[root@satellite57 ~]# spacecmd system_listbasechannel system001.example.com
INFO: Connected to https://localhost/rpc/api as admin
rhel-x86_64-server-6
spacecmd help を使用するとすべてのコマンドが一覧表示されます。