3.4. 使用しなくなった Satellite 5 Server のリタイア
本セクションでは、Red Hat Satellite 5 Server から新規に Satellite 6 Server への完全移行を実行した後に、不要となった Satellite 5 Server をリタイアする方法について説明します。Satellite 5 から新しい RHSM システムに移行した場合は、「新しい Satellite 6 へのサブスクリプションの移行」 に進んでください。
Satellite 5 を新規の RHSM システムに移行していない場合は、コンテンツ管理ガイドの サブスクリプションの管理 の説明に従ってマニフェストを新規作成し、新しい Satellite 6 に追加します。オプションで、以下の Python スクリプトを実行して、以前の Satellite のプロファイルを RHN から削除します。
#!/usr/bin/env python
import getpass
import os
import sys
import libxml2
import xmlrpclib
from optparse import OptionParser
DEFAULT_SERVERFQDN="xmlrpc.rhn.redhat.com"
parser = OptionParser()
parser.add_option("-l", "--login", dest="login", help="Login user for RHN Satellite/Hosted", metavar="LOGIN")
parser.add_option("-p", "--password", dest="password", help="Password for specified user. Will prompt if omitted", metavar="PASSWORD")
parser.add_option("-s", "--server", dest="serverfqdn", help="FQDN of satellite server - omit https:// (default: %s)" % DEFAULT_SERVERFQDN, metavar="SERVERFQDN", default=DEFAULT_SERVERFQDN)
(options, args) = parser.parse_args()
if not options.login:
print "Must specify login option. See usage:"
parser.print_help()
print "\nExample usage: ./decommissionServer.py -l admin -p password"
sys.exit(1)
else:
login = options.login
password = options.password
serverfqdn = options.serverfqdn
if not password: password = getpass.getpass("%s's password:" % login)
SATELLITE_URL = "https://%s/rpc/api" % serverfqdn
SATELLITE_LOGIN = login
SATELLITE_PASSWORD = password
SYSTEMID_FILE = "/etc/sysconfig/rhn/systemid"
# Check For root
# Have to be root to open the SYSTEMID_FILE which is chmod'd 0600
if os.getuid() != 0:
print "This script requires root-level access to run."
sys.exit(1)
# Log into Satellite and get an authentication token
client = xmlrpclib.Server(SATELLITE_URL, verbose=0)
key = client.auth.login(SATELLITE_LOGIN, SATELLITE_PASSWORD)
# Parse /etc/sysconfig/rhn/systemid to ge the system ID
# Use the systemid and delete the systems RHN profile
parsed_file = libxml2.parseDoc(file(SYSTEMID_FILE).read())
systemid = parsed_file.xpathEval('string(//member[* ="system_id"]/value/string)').split('-')[1]
print systemid
try:
client.system.deleteSystems(key,int(systemid))
print "The system with SystemID " + systemid + " was successfully deleted"
except xmlrpclib.Fault, e:
print "XMLRPC fault \n\t%s" % e
# Logout of Satellite
client.auth.logout(key)3.4.1. 新しい Satellite 6 へのサブスクリプションの移行
本セクションは、使用していた Satellite 5 Server から新しい Satellite 6 Server へサブスクリプションを移行する方法を説明します。
新しいサブスクリプションを設定します。
- カスタマーポータル にログインし、サブスクリプション に移動します。
- インベントリー に移動して Satellite 組織 をクリックします。
- 移行する Satellite 5 Server の名前の左側にあるチェックボックスを選択し、選択した項目を削除 をクリックします。警告ボックスが表示されるので 削除 をクリックしてユニットを削除します。
- 新しい Satellite 6 Server の名前をクリックし、移行サブスクリプション名の左側にあるチェックボックスを選択します。選択項目の削除 をクリックします。警告ボックスが表示されるので、削除 をクリックしてサブスクリプションを削除します。
- サブスクリプションのアタッチ をクリックし、適切な Satellite サブスクリプションを選択し、選択項目のアタッチ をクリックします。
新しい Satellite 6 Server で以下のコマンドを実行し、サブスクリプションマネージャーを更新します。
# subscription-manager refresh
新しい Satellite 6 Server でリポジトリーを有効にします。
移行する Satellite 5 Server で、以下のコマンドを使用して、有効にしたチャンネルを表示します。
# spacewalk-channel -l
新しい Satellite 6 Server で、以下のコマンドを使用して、組織で有効になっているリポジトリーを一覧表示します。
# hammer product list --organization "organization_name"新しい Satellite 6 Server で、必要なリポジトリーがすべて有効になるように設定します。
Web UI をご利用の場合
Content → Red Hat Repositories に移動して、有効にするリポジトリーを選択します。
CLI をご利用の場合
名前または ID 番号を使用してリポジトリーを有効にします。任意で、リリース番号とベースアーキテクチャーを追加できます。
# hammer repository-set enable \ --product "product_name" \ --name "repository_name" \ --organization "org_name" \ --releasever "" \ --basearch "x86_64"