Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
532 changes: 532 additions & 0 deletions POSHOrigin_NetScaler/Examples/holdup.ps1

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions POSHOrigin_NetScaler/POSHOrigin_NetScaler.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
RootModule = 'POSHOrigin_NetScaler.psm1'

# Version number of this module.
ModuleVersion = '1.1.2'
ModuleVersion = '1.1.3'

# ID used to uniquely identify this module
GUID = 'bd4390dc-a8ad-4bce-8d69-f53ccf8e4163'
Expand All @@ -24,7 +24,7 @@
RequiredModules = 'NetScaler'

# DSC resources to export from this module
DscResourcesToExport = @('LBVirtualServer', 'LBServer')
DscResourcesToExport = @('LBVirtualServer','LBServer','LBMonitor','LBServiceGroupMonitorBinding','LBServiceGroup','LBNTPServer','LBResponderPolicy','LBResponderAction','LBResponderHTMLPage','LBRewritePolicy','LBRewriteAction','LBDNSServer','LBNSMode','LBNSFeature','LBNSIP','LBVirtualServerBinding','LBSystemFile','LBVLAN','LBResponderPolicyBinding','LBServiceGroupMember','LBService','LBServiceMonitorBinding','LBSSLCertificate','LBSSLCertificateBinding','LBSSLCertificateLink','LBSSLProfile','LBSSLToVserverProfileBinding','LBSSLProfileToVserverBinding','LBCipherToVserverBinding')

PrivateData = @{
PSData = @{
Expand Down
6,532 changes: 6,173 additions & 359 deletions POSHOrigin_NetScaler/POSHOrigin_NetScaler.psm1

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions old/POSHOrigin_NetScaler/Examples/Example_LBServer.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
$DscConfigData = @{
AllNodes = @(
@{
NodeName = "*"
PSDscAllowPlainTextPassword = $true
PSDscAllowDomainUser = $true
}
@{
NodeName = 'localhost'
}
)
}

Configuration Example_LBServer {
param(
[string[]]$NodeName = 'localhost',

[Parameter(Mandatory)]
[string]$Name,

[Parameter(Mandatory)]
[string]$IPAddress,

[Parameter(Mandatory)]
[string]$NetScalerFQDN,

[Parameter(Mandatory)]
[pscredential]$Credential,

[string]$Comments,

[int]$TrafficDomainId,

[string]$State
)

Import-DscResource -Name LBServer -ModuleName POSHOrigin_NetScaler

Node $NodeName {
LBServer "Create$Name" {
Ensure = 'Present'
Name = $Name
IPAddress = $IPAddress
NetScalerFQDN = $NetScalerFQDN
Credential = $Credential
Comments = $Comments
TrafficDomainId = $TrafficDomainId
State = $State
}
}
}
57 changes: 57 additions & 0 deletions old/POSHOrigin_NetScaler/Examples/Example_LBVirtualServer.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
$DscConfigData = @{
AllNodes = @(
@{
NodeName = "*"
PSDscAllowPlainTextPassword = $true
PSDscAllowDomainUser = $true
}
@{
NodeName = 'localhost'
}
)
}

Configuration Example_LBVirtualServer {
param(
[string[]]$NodeName = 'localhost',

[Parameter(Mandatory)]
[string]$Name,

[Parameter(Mandatory)]
[string]$IPAddress,

[Parameter(Mandatory)]
[string]$NetScalerFQDN,

[Parameter(Mandatory)]
[pscredential]$Credential,

[int]$Port,

[string]$ServiceType,

[string]$LBMethod,

[string]$Comments,

[string]$State
)

Import-DscResource -Name LBVirtualServer -ModuleName POSHOrigin_NetScaler

Node $NodeName {
LBVirtualServer "Create$Name" {
Ensure = 'Present'
Name = $Name
IPAddress = $IPAddress
NetScalerFQDN = $NetScalerFQDN
Credential = $Credential
Port = $Port
ServiceType = $ServiceType
LBMethod = $LBMethod
Comments = $Comments
State = $State
}
}
}
12 changes: 12 additions & 0 deletions old/POSHOrigin_NetScaler/Examples/Example_POSHOrigin_LBServer.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
resource 'POSHOrigin_NetScaler:LBServer' 'serverxyz' @{
Ensure = 'Present'
NetScalerFQDN = 'mynetscaler.mydomain.com'
IPAddress = '192.168.100.100'
Comments = 'This is a comment'
TrafficDomainId = 1
State = 'ENABLED'
Credential = Get-POSHOriginSecret 'pscredential' @{
username = 'administrator'
password = 'K33p1t53cr3tK33p1t5@f3'
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
resource 'POSHOrigin_NetScaler:LBServer' 'lbserverxyz' @{
Ensure = 'Present'
NetScalerFQDN = 'mynetscaler.mydomain.com'
Comments = 'This is a comment'
IPAddress = '192.168.100.101'
Port = 80
ServiceType = 'HTTP'
LBMethod = 'ROUNDROBIN'
State = 'ENABLED'
Credential = Get-POSHOriginSecret 'pscredential' @{
username = 'administrator'
password = 'K33p1t53cr3tK33p1t5@f3'
}
}
133 changes: 133 additions & 0 deletions old/POSHOrigin_NetScaler/Invoke.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<#
This script expects to be passed a psobject with all the needed properties
in order to invoke 'NetScaler' DSC resources.
#>
[cmdletbinding()]
param(
[parameter(mandatory)]
[psobject]$Options,

[bool]$Direct = $false
)

# Ensure we have a valid 'ensure' property
if ($null -eq $Options.options.Ensure) {
$Options.Options | Add-Member -MemberType NoteProperty -Name Ensure -Value 'Present' -Force
}

# Get the resource type
$type = $Options.Resource.split(':')[1]

$hash = @{
Name = $Options.Name
Ensure = $Options.options.Ensure
Credential = $Options.Options.Adminuser.Credential
NetScalerFQDN = $Options.Options.NetScalerFQDN
}

$export = $false
if ($Options.options.ParameterExport) {
$export = [bool]$Options.options.ParameterExport
}

switch ($type) {
'LBServer' {
if ($Direct) {
$hash.IPAddress = $Options.Options.IPAddress
$hash.Comments = $Options.Options.Description
$hash.TrafficDomainId = $Options.Options.TrafficDomainId
$hash.State = $Options.Options.State
$hash.ParameterExport = $export
return $hash
} else {
$confName = "$type" + '_' + $Options.Name
Write-Verbose -Message "Returning configuration function for resource: $confName"
Configuration $confName {
Param (
[psobject]$ResourceOptions
)

Import-DscResource -Name LBServer -ModuleName POSHOrigin_NetScaler

# Credentials may be specified in line. Test for that
if ($ResourceOptions.Options.Credential -is [pscredential]) {
$cred = $ResourceOptions.Options.Credential
}

# Credentials may be listed under secrets. Test for that
if ($ResourceOptions.options.secrets.Credential) {
$cred = $ResourceOptions.options.secrets.Credential.credential
}

if (-Not $ResourceOptions.options.State) {
$ResourceOptions.options | Add-Member -MemberType NoteProperty -Name State -Value 'ENABLED'
}

LBServer $ResourceOptions.Name {
Ensure = $ResourceOptions.options.Ensure
Name = $ResourceOptions.Name
NetScalerFQDN = $ResourceOptions.options.netscalerfqdn
Credential = $cred
IPAddress = $ResourceOptions.options.IPAddress
TrafficDomainId = $ResourceOptions.options.TrafficDomainId
Comments = $ResourceOptions.options.comments
State = $ResourceOptions.options.State
ParameterExport = $export
}
}
}
}
'LBVirtualServer' {
if ($Direct) {
$hash.IPAddress = $Options.Options.IPAddress
$hash.Port = $Options.Options.Port
$hash.LBMethod = $Options.Options.LBMethod
$hash.Comments = $Options.Options.Description
$hash.ServiceGroup = $Options.Options.ServiceGroup
$hash.Service = $Options.Options.Service
$hash.State = $Options.Options.State
$hash.ParameterExport = $export
return $hash
} else {
$confName = "$type" + '_' + $Options.Name
Write-Verbose -Message "Returning configuration function for resource: $confName"
Configuration $confName {
Param (
[psobject]$ResourceOptions
)

Import-DscResource -Name LBVirtualServer -ModuleName POSHOrigin_NetScaler

# Credentials may be specified in line. Test for that
if ($ResourceOptions.Options.Credential -is [pscredential]) {
$cred = $ResourceOptions.Options.Credential
}

# Credentials may be listed under secrets. Test for that
if ($ResourceOptions.options.secrets.Credential) {
$cred = $ResourceOptions.options.secrets.Credential.credential
}

if (-Not $ResourceOptions.options.State) {
$ResourceOptions.options | Add-Member -MemberType NoteProperty -Name State -Value 'ENABLED'
}

LBVirtualServer $ResourceOptions.Name {
Ensure = $ResourceOptions.options.Ensure
Name = $ResourceOptions.Name
NetScalerFQDN = $ResourceOptions.options.netscalerfqdn
Credential = $cred
IPAddress = $ResourceOptions.options.IPAddress
Port = $ResourceOptions.options.Port
ServiceType = $ResourceOptions.options.servicetype
LBMethod = $ResourceOptions.options.lbmethod
ServiceGroup = $ResourceOptions.options.servicegroup
Service = $ResourceOptions.options.service
Comments = $ResourceOptions.options.comments
State = $ResourceOptions.options.State
ParameterExport = $export
}
}
}
}
}
44 changes: 44 additions & 0 deletions old/POSHOrigin_NetScaler/POSHOrigin_NetScaler.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
@{
# Script module or binary module file associated with this manifest.
RootModule = 'POSHOrigin_NetScaler.psm1'

# Version number of this module.
ModuleVersion = '1.1.2'

# ID used to uniquely identify this module
GUID = 'bd4390dc-a8ad-4bce-8d69-f53ccf8e4163'

# Author of this module
Author = 'Brandon Olin'

# Copyright statement for this module
Copyright = '(c) 2015 Brandon Olin. All rights reserved.'

# Description of the functionality provided by this module
Description = 'POSHOrigin DSC module to manage Citrix NetScaler resources.'

# Minimum version of the Windows PowerShell engine required by this module
PowerShellVersion = '5.0'

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = 'NetScaler'

# DSC resources to export from this module
DscResourcesToExport = @('LBVirtualServer','LBServer','LBMonitor','LBServiceGroup','LBNTPServer','LBResponderPolicy','LBResponderAction','LBSSLCertificate','LBRewritePolicy','LBRewriteAction','LBDNSServer','LBNSMode','LBNSFeature','LBNSIP','LBNSVirtualServerBinding','LBSystemFile','LBVLAN')

PrivateData = @{
PSData = @{
# Tags applied to this module. These help with module discovery in online galleries.
Tags = @(
'Desired State Configuration',
'DSC',
'POSHOrigin',
'Citrix',
'NetScaler',
'Load balancing',
'Infrastructure as Code',
'IaC'
)
}
}
}
Loading