vRealize Orchestrator 호스팅된 워크플로를 사용하여 ITSM 규정 준수를 위해 Cloud Assembly와 ServiceNow를 통합할 수 있습니다.

ServiceNow 통합 흐름은 여러 Cloud Assembly, vSphere, vRealize Orchestrator, ServiceNow 서비스 및 API를 거칩니다.

엔터프라이즈 사용자는 규정 준수를 위해 일반적으로 Cloud Management Platform을 ITSM(IT 서비스 관리) 및 CMDB(구성 관리 데이터베이스) 플랫폼과 통합합니다. 이 예시를 사용하면 vRealize Orchestrator 호스팅된 워크플로를 사용하여 CMDB 및 ITSM을 위해 Cloud Assembly를 ServiceNow와 통합할 수 있습니다. vRealize Orchestrator 통합 및 워크플로를 사용할 때 기능 태그는 서로 다른 환경에 대해 인스턴스가 여러 개 있는 경우에 특히 유용합니다. 기능 태그에 대한 자세한 내용은 Cloud Assembly에서 기능 태그 사용 항목을 참조하십시오.
참고: 확장성 작업 스크립트를 사용하여 ServiceNow를 Cloud Assembly와 통합할 수도 있습니다. 확장성 작업 스크립트를 사용한 ServiceNow 통합에 대한 자세한 내용은 확장성 작업을 사용하여 Cloud Assembly와 ServiceNow를 통합하는 방법 항목을 참조하십시오.

이 예시에서 ServiceNow 통합은 3개의 최상위 수준 워크플로로 구성되며, 각 워크플로에는 자체 구독이 포함되어 있어 각 구성 요소를 개별적으로 업데이트하고 반복할 수 있습니다.

  • 이벤트 구독 진입점 - 기본 로깅을 사용하며, 요청하는 사용자 및 vCenter VM(해당하는 경우)을 식별합니다.
  • 통합 워크플로 - 개체 및 피드 입력을 기술 워크플로로 분리하고 로깅, 속성 및 출력 업데이트를 처리합니다.
  • 기술 워크플로 - 페이로드 이외의 추가적인 가상 시스템 속성을 사용하여 CMDB CI, CR 및 Cloud Assembly IaaS API를 생성하기 위한 ServiceNow API용 다운스트림 시스템 통합입니다.

사전 요구 사항

  • 독립형 또는 클러스터링된 vRealize Orchestrator 환경.
  • Cloud AssemblyvRealize Orchestrator 통합. Cloud Assembly와 독립형 vRealize Orchestrator 통합에 대한 자세한 내용은 Cloud Assembly에서 vRealize Orchestrator 통합 구성 항목을 참조하십시오.

프로시저

  1. 여러 워크플로에 사용되는 공통 구성이 포함된 구성 파일을 vRealize Orchestrator에서 생성하고 저장합니다.
  2. Cloud Assembly API 토큰을 1단계의 구성 파일과 동일한 위치에 저장합니다.
    참고: Cloud Assembly API 토큰에는 만료 기간이 있습니다.
  3. 제공된 스크립트 요소를 사용하여 vRealize Orchestrator에서 워크플로를 생성합니다. 이 스크립트는 REST 호스트를 참조하고 해당 위치를 찾습니다. 또한 추가적인 인증 헤더로 추가되는 토큰의 선택적 매개 변수를 사용하는 REST 작업을 표준화합니다.
    var configPath = "CS"
    var configName = "environmentConfig"
    var attributeName = "CASRestHost"
    
    //get REST Host from configuration element
    var restHost = System.getModule("au.com.cs.example").getRestHostFromConfig(configPath,configName,attributeName)
    
    var ConfigurationElement = System.getModule("au.com.cs.example").getConfigurationElementByName(configName,configPath);
    System.debug("ConfigurationElement:" + ConfigurationElement);
    var casToken = ConfigurationElement.getAttributeWithKey("CASToken")["value"]
    if(!casToken){
    	throw "no CAS Token";
    }
    //REST Template
    var opName = "casLogin";
    var opTemplate = "/iaas/login";
    var opMethod = "POST";
    
    // create the REST operation:
    var opLogin = System.getModule("au.com.cs.example").createOp(restHost,opName,opMethod,opTemplate);
    
    //cas API Token
    var contentObject = {"refreshToken":casToken}
    postContent = JSON.stringify(contentObject);
    
    var loginResponse = System.getModule("au.com.cs.example").executeOp(opLogin,null,postContent,null) ;
    
    try{
    	var tokenResponse = JSON.parse(loginResponse)['token']
    	System.debug("token: " + tokenResponse);
    } catch (ex) {
    	throw ex + " No valid token";
    }
    
    //REST Template  Machine Details
    var opName = "machineDetails";
    var opTemplate = "/iaas/machines/" + resourceId;
    var opMethod = "GET";
    
    var bearer = "Bearer " + tokenResponse;
    
    var opMachine = System.getModule("au.com.cs.example").createOp(restHost,opName,opMethod,opTemplate);
    
    // (Rest Operation, Params, Content, Auth Token)
    var vmResponse = System.getModule("au.com.cs.example").executeOp(opMachine,null,"",bearer) ;
    
    try{
    	var vm = JSON.parse(vmResponse);
    } catch (ex) {
    	throw ex + " failed to parse vm details"
    }
    
    System.log("cpuCount: " + vm["customProperties"]["cpuCount"]);
    System.log("memoryInMB: " + vm["customProperties"]["memoryInMB"]);
    
    cpuCount =  vm["customProperties"]["cpuCount"];
    memoryMB = vm["customProperties"]["memoryInMB"];

    이 스크립트는 cpuCountmemoryMB 출력을 상위 워크플로에 보내고 기존 customProperties 속성을 업데이트합니다. 이러한 값은 CMDB를 생성할 때 이후 워크플로에서 사용할 수 있습니다.

  4. ServiceNow CMDB CI 생성 스크립트 요소를 워크플로에 추가합니다. 이 요소는 구성 항목을 사용하여 ServiceNow REST 호스트의 위치를 찾고, cmdb_ci_vmware_instance 표의 REST 작업을 생성하며, 사후 데이터를 위해 워크플로 입력에 기반한 컨텐츠 개체 문자열을 생성한 후, 반환되는 sys_id를 출력합니다.
    var configPath = "CS"
    var configName = "environmentConfig"
    var attributeName = "serviceNowRestHost"
    var tableName = "cmdb_ci_vmware_instance"
    
    //get REST Host from configuration element
    var restHost = System.getModule("au.com.cs.example").getRestHostFromConfig(configPath,configName,attributeName)
    
    //REST Template
    var opName = "serviceNowCreatCI";
    var opTemplate = "/api/now/table/" + tableName;
    var opMethod = "POST";
    
    // create the REST operation:
    var opCI = System.getModule("au.com.cs.example").createOp(restHost,opName,opMethod,opTemplate);
    
    
    //cmdb_ci_vm_vmware table content to post;
    var contentObject = {};
    contentObject["name"] = hostname;
    contentObject["cpus"] = cpuTotalCount;
    contentObject["memory"] = MemoryInMB;
    contentObject["correlation_id"]=  deploymentId
    contentObject["disks_size"]=  diskProvisionGB
    contentObject["location"] = "Sydney";
    contentObject["vcenter_uuid"] = vcUuid;
    contentObject["state"] = "On";
    contentObject["owned_by"] = owner;
    
    postContent = JSON.stringify(contentObject);
    System.log("JSON: " + postContent);
    
    // (Rest Operation, Params, Content, Auth Token)
    var ciResponse = System.getModule("au.com.cs.example").executeOp(opCI,null,postContent,null) ;
    
    try{
    	var cmdbCI = JSON.parse(ciResponse);
    } catch (ex) {
    	throw ex + " failed to parse ServiceNow CMDB response";
    }
    
    serviceNowSysId = cmdbCI['result']['sys_id'];
  5. 하위 워크플로의 출력을 사용하여 기존 customProperties를 사용하는 속성 개체를 생성하고 ServiceNow의 값으로 serviceNowSysId 속성을 덮어씁니다. 이 고유 ID는 삭제 시 CMDB에서 인스턴스를 회수된 것으로 표시하기 위해 사용됩니다.

결과

Cloud Assembly가 ITSM ServiceNow와 통합되었습니다. 워크플로를 사용하여 Cloud Assembly에 ServiceNow를 통합할 수 있는 방법에 대한 자세한 내용은 ServiceNow 통합을 위해 vRealize Orchestrator를 사용하여 Cloud Assembly 확장을 참조하십시오.