How to Transfer Non-Patching Content Delivery with RPS
Last updated on August 4, 2021.
Document Status: Document Feature Complete as of August 4, 2021; PENDING EXTERNAL REVIEW.
Overview
The Rapid Provisioning System (RPS) can replicate non-patching content, such as log shipping information, to nodes within the local domain and to nodes outside of the local domain. Non-Patching content delivery can be achieved using PowerShell and RPS cmdlets.
Prerequisites
Users performing non-patching content delivery should have the RPS Patching role or be assigned RPS Admin permissions, and have knowledge and experience using PowerShell and RPS.
Resource Type Definition
To create transferable non-patching content, the Resource Type Definition must be set. This property will enable RPS to include this information when it configures DFSR and/or BITS for replication to the target node. For information on enabling DFSR and BITS, see How to Enable and Disable CDN Communication.
To set the Resource Type Definition:
Login to RPS and open a PowerShell window as Administrator.
Execute the following PowerShell code block:
$type = Set-RpsResourceType -Name 'Logs' -IsContentDistribution -CdnDirection Downstream $null = Set-RpsTypeProperty -Parent $type -Name 'DisplayName' -PropertyType Text
The above command will configure any Resource Item (content) of type 'Logs' to be marked as transferable content.
The -CdnDirection parameter determines the direction of data transfer and has two possible options:
- Downstream: the direction for content transfer will be to child nodes.
- Upstream: the direction for content transfer will be to parent nodes.
Note
'Logs' and 'DisplayName' are example values only and should be customized in the script to user requirements.
Create a Resource Item
Next, the content must be created using the New-ResourceItem cmdlet.
The following code block will set variables and create a new ResourceItem.
$contentType = 'Logs'
$contentName = 'Firewall Logs'
$newContent = New-RpsResourceItem -Type $contentType -Name $contentName -IsGlobal $true -Properties @{ DisplayName = $contentName }
Note
Users must specify the $ContentType and $ContentName variables.
The following code block sets the FolderID and the FolderResourceID on the newly created content:
$folderId = [Rps.Api.Utils.HashingUtils]::Reverse($newContent.Id)
$newContent.FolderResourceId = $folderId
$newContent.Update()
The following code block gets the CDN Folder, creates a new directory in the CDN folder, and configures Folder Data in CMDB:
$localNode = Get-RpsLocalNode
$cdnPath = $localNode.CdnPath
$null = New-Item -Path $cdnPath -Name $folderId -ItemType Directory
$fileCatalog = [Rps.Api.Utils.FileUtils]::BuildFolderCatalog($(Join-Path -Path $cdnPath -ChildPath $folderId))
[Rps.Api.Utils.FileUtils]::CreateFolderCatalog($fileCatalog, $contentName, $folderId)
Assign the Resource Item (Content) to a Target Node
Now the ResourceItem must be assigned to a target in order to be transferred. This is accomplished with the following code block:
$regionTarget = Get-RpsTargetItem -Name <app.region.rps> -Type VirtualMachine
$siteTarget = Get-RpsTargetItem -Name <app-s.region.rps> -Type VirtualMachine
$null = $newContent.AssignTo($regionTarget)
$null = $newContent.AssignTo($siteTarget)
Note
Users must specify the target node in the -Name parameter of this code block.
PowerShell Script Example
The below script can be copied and pasted to perform all of the discussed actions at once.
# Variables
$contentType = 'Logs'
$contentName = 'FirewallLogs'
# Create Type Definition for new Content
$type = Set-RpsResourceType -Name 'Logs' -IsContentDistribution -CdnDirection Downstream
$null = Set-RpsTypeProperty -Parent $type -Name 'DisplayName' -PropertyType Text
# Create the resource item with the same type
$newContent = New-RpsResourceItem -Type $contentType -Name $contentName -IsGlobal $true -Properties @{ DisplayName = $contentName }
# Get the folder Id. FolderId is the reverse of the content resource item
$folderId = [Rps.Api.Utils.HashingUtils]::Reverse($newContent.Id)
# Set FolderResourceId on the new content.
$newContent.FolderResourceId = $folderId
$newContent.Update()
# Get CDN Folder
$localNode = Get-RpsLocalNode
$cdnPath = $localNode.CdnPath
# Create folder
$null = New-Item -Path $cdnPath -Name $folderId -ItemType Directory
# Configure Folder data in CMDB
$fileCatalog = [Rps.Api.Utils.FileUtils]::BuildFolderCatalog($(Join-Path -Path $cdnPath -ChildPath $folderId))
[Rps.Api.Utils.FileUtils]::CreateFolderCatalog($fileCatalog, $contentName, $folderId)
# Assign content to targets on each node you want to send the data to
$regionTarget = Get-RpsTargetItem -Name <app.region.rps> -Type VirtualMachine
$siteTarget = Get-RpsTargetItem -Name <app-s.region.rps> -Type VirtualMachine
$null = $newContent.AssignTo($regionTarget)
$null = $newContent.AssignTo($siteTarget)
Note
The $contentType and $contentName variables, and the -CdnDirection and -Name parameter values
in the above script are examples only and must be customized by the user for the script to execute properly.