È possibile includere comandi EPM Automate in script Groovy su lato server per clonare ambienti per finalità di disaster recovery. In questo modo è possibile impostare le azioni di disaster recovery senza footprint in locale.
Se le password contengono caratteri speciali, fare riferimento alla sezione Gestione dei caratteri speciali. Assicurarsi inoltre di sostituire i valori dei parametri elencati di seguito a seconda degli ambienti.
Table 4-1 Parametri da modificare
| Parametro | Descrizione |
|---|---|
password |
Password dell'amministratore dei servizi che esegue l'operazione di clonazione nell'ambiente di origine. |
targetpassword |
Password dell'amministratore di servizi che esegue l'operazione di clonazione nell'ambiente target. |
username |
ID utente dell'amministratore di servizi nell'ambiente di origine. |
targetusername |
ID utente dell'amministratore di servizi nell'ambiente target. Questo utente deve essere assegnato anche al ruolo Amministratore del dominio di Identity nell'ambiente target. |
email_id |
Indirizzo e-mail a cui si intende inviare informazioni sul processo di clonazione. |
Script per la cifratura della password
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())
Script per la clonazione dell'ambiente
Questo script utilizza i password file cifrati creati utilizzando lo script precedente.
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())