Umgebungen mit einem serverseitigen Groovy-Skript klonen

Sie können EPM Automate-Befehle in serverseitige Groovy-Skripte einschließen, um Umgebungen für Disaster Recovery-Zwecke zu klonen. So können Sie eine Disaster Recovery ohne On-Premise-Footprint einrichten.

Wenn Kennwörter Sonderzeichen enthalten,finden Sie weitere Informationen unter Sonderzeichen verarbeiten. Stellen Sie zudem sicher, dass die folgenden Parameterwerte so ersetzt werden, dass Sie zu Ihren Umgebungen passen:

Table 4-1 Zu ändernde Parameter

Parameter Beschreibung
password Das Kennwort des Serviceadministrators, der den Klonvorgang in der Quellumgebung durchführt.
targetpassword Das Kennwort des Serviceadministrators, der den Klonvorgang in der Zielumgebung durchführt.
username Die Benutzer-ID des Serviceadministrators in der Quellumgebung.
targetusername Die Benutzer-ID des Serviceadministrators in der Zielumgebung. Diesem Benutzer muss zudem die Rolle Identitätsdomainadministrator in der Zielumgebung zugewiesen sein.
email_id Die E-Mail-Adresse, an die Sie Informationen zum Klonprozess senden möchten.

Skript zum Verschlüsseln von Kennwörtern

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())

Skript zum Klonen von Umgebungen

Dieses Skript verwendet die verschlüsselten Kennwortdateien, die mit dem vorherigen Skript erstellt wurden.

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())