サーバー側のGroovyスクリプトを使用した環境のクローニング

サーバー側のGroovyスクリプトにEPM自動化コマンドを追加して、障害回復目的で環境をクローニングできます。これにより、オンプレミスのフットプリントなしで障害回復を設定できます。

パスワードに特殊文字が含まれている場合は、特殊文字の処理を参照してください。また、使用環境にあわせて次のパラメータ値を確実に置き換えてください:

Table 4-1 変更するパラメータ

パラメータ 説明
password ソース環境でクローン操作を実行しているサービス管理者のパスワード。
targetpassword ターゲット環境でクローン操作を実行しているサービス管理者のパスワード。
username ソース環境のサービス管理者のユーザーID。
targetusername ターゲット環境のサービス管理者のユーザーID。このユーザーは、ターゲット環境のアイデンティティ・ドメイン管理者の役割にも割り当てられている必要があります。
email_id クローニング・プロセスに関する情報を送信する予定の電子メール・アドレス。

パスワードを暗号化するためのスクリプト

EpmAutomate automate = getEpmAutomate()

//Encrypt the password of a Service Administrator in the source environment
EpmAutomateStatus encryptstatus1 = automate.execute('encrypt', 'password','encryptionKey','sourcePassword.epw')
if(encryptstatus1.getStatus() != 0)  throwVetoException(encryptstatus1.getOutput())
println(encryptstatus1.getOutput())

//Encrypt the password of a Service Administrator in the target environment
//This user must also have the Identity Domain Administrator 
//role in the target environment

EpmAutomateStatus encryptstatus2= automate.execute('encrypt', 'targetpassword',
'encryptionKey', 'targetPassword.epw')
if(encryptstatus2.getStatus() != 0) throwVetoException(encryptstatus2.getOutput())
println(encryptstatus2.getOutput())

環境をクローニングするためのスクリプト

このスクリプトでは、前述のスクリプトを使用して作成した暗号化されたパスワード・ファイルを使用します。

EpmAutomate automate = getEpmAutomate()

//Log into the target environment
EpmAutomateStatus loginstatus = automate.execute('login', 'username','targetPassword.epw' , 'targeturl')
if(loginstatus.getStatus() != 0) throwVetoException(loginstatus.getOutput())
println(loginstatus.getOutput())

//Recreate the target environment
EpmAutomateStatus recreatestatus = automate.execute('recreate' , '-f' )
if(recreatestatus.getStatus() != 0) throwVetoException(recreatestatus.getOutput())
println(recreatestatus.getOutput())

//Copy Artifact Snapshot from the source environment 
//to the target environment
EpmAutomateStatus copystatus = automate.execute('copysnapshotfrominstance',
'Artifact Snapshot', 'sourceusername', 'sourcePassword.epw','source url')
if(copystatus.getStatus() != 0) throwVetoException(copystatus.getOutput())
println(copystatus.getOutput())

//import Artifact Snapshot into the target environment
EpmAutomateStatus importstatus = automate.execute('importsnapshot', 'Artifact Snapshot')
println(importstatus.getOutput())

//Send an email to a designated user with the status of the 
//snapshot import process
EpmAutomateStatus emailstatus = automate.execute('sendmail', 'email_id' ,'Status of DR' , 'BODY='+ importstatus.getOutput())
println(emailstatus.getOutput())

//Sign out of the target environment
EpmAutomateStatus logoutstatus = automate.execute('logout')
println(logoutstatus.getOutput())