DSC + Tentacle install/uninstall/install gives error

Hi,

Dalmiro referred me to this site via Twitter, so here I am. I hope that someone can assist me.
I’m using PowerShell DSC to install and uninstall Tentacle on servers.

To install it:

configuration OctopusDeployTentacleConfiguration {
param (
[parameter(Mandatory=$true,Position=1)][string[]]$ComputerName,
[parameter(Mandatory=$true,Position=2)][ValidateSet(‘Development’,‘Test’,‘Acceptation’,‘Production’)]$Environment
)
Import-DscResource -ModuleName OctopusDSC
Node $ComputerName {
File OctopusDeployTentacle {
DestinationPath = 'c:\Octopus\Tentacle.msi’
Ensure = 'Present’
Type = 'File’
Force = $true
SourcePath = '\dscdc1\dsc\OctopusDeploy\OctopusTentacle\Octopus.Tentacle.2.5.8.447-x64.msi’
DependsOn = “[File]DefaultApplicationDirectory”
}
File OctopusDeployTentacleOriginalName {
DestinationPath = 'c:\Octopus\Octopus.Tentacle.2.5.8.447-x64.msi’
Ensure = 'Present’
Type = 'File’
Force = $true
SourcePath = '\dscdc1\dsc\OctopusDeploy\OctopusTentacle\Octopus.Tentacle.2.5.8.447-x64.msi’
DependsOn = “[File]DefaultApplicationDirectory”
}
cTentacleAgent OctopusDeployTentacleConfiguration {
Ensure = "Present"
State = "Started"
Name = "Tentacle"
ApiKey = “4F17735C3A8FEFB12E367BD684B484715E0029ED"
OctopusServerUrl = “http://DSCDC1.LAN/
Environments = @(”$Environment”)
Roles = @(“Web-Server”)
ListenPort = 10933
DefaultApplicationDirectory = “C:\Octopus\Applications"
DependsOn = “[File]OctopusDeployTentacle”,”[File]OctopusDeployTentacleOriginalName”
}
}
}
OctopusDeployTentacleConfiguration -ComputerName ‘SRV01’ -OutputPath ‘C:\Staging\OctopusDeployTentacleConfiguration’ -Environment 'Development’
Start-DscConfiguration -Path ‘C:\dsc\Staging\OctopusDeployTentacleConfiguration’ -Wait -Verbose -Force

So far so good, install works just fine (although I’m not seeing the tentacle in the mgmt console of Octopus).
I uninstall tentacle via:
configuration OctopusDeployTentacle {
param (
[string[]]$ComputerName = ‘localhost’
)
Node $ComputerName {
Package OctopusDeployTentacle {
Name = 'Octopus Deploy Tentacle’
Ensure = 'Absent’
Path = '\dscdc1\dsc\OctopusDeploy\OctopusTentacle\Octopus.Tentacle.2.5.8.447-x64.msi’
Arguments = "/q"
ProductId = ‘44CE5578-8416-466E-85B9-5ABD3C68B060’
}
}
}
OctopusDeployTentacle -OutputPath ‘C:\dsc\Staging\OctopusDeployTentacle’ -ComputerName 'SRV01’
Start-DscConfiguration -Path ‘C:\dsc\Staging\OctopusDeployTentacle’ -Wait -Force -Verbose

Again, so far so good (although there are some leftovers in %ProgramFiles% … forgot to include that in the MSI for removal?).
Now, when I re-install Tentacle via the DSC configuration above, I get an error I just can’t seem to get around next to re-installing both Octopus Server and the entire VM where Tentacle resides:

VERBOSE: Perform operation ‘Invoke CimMethod’ with following parameters, ‘‘methodName’ = SendConfigurationApply,‘className’ = MSFT_DSCLocalConfig
urationManager,‘namespaceName’ = root/Microsoft/Windows/DesiredStateConfiguration’.
VERBOSE: An LCM method call arrived from computer DSCDC1 with user sid S-1-5-21-2118080165-4222493788-4173560851-500.
VERBOSE: An LCM method call arrived from computer DSCDC1 with user sid S-1-5-21-2118080165-4222493788-4173560851-500.
VERBOSE: [SRV01]: LCM: [ Start Set ]
VERBOSE: [SRV01]: LCM: [ Start Resource ] [[File]DefaultApplicationDirectory]
VERBOSE: [SRV01]: LCM: [ Start Test ] [[File]DefaultApplicationDirectory]
VERBOSE: [SRV01]: [[File]DefaultApplicationDirectory] The network path was not found.
VERBOSE: [SRV01]: [[File]DefaultApplicationDirectory] The related file/directory is: \dscds1\dsc\Empty.
VERBOSE: [SRV01]: [[File]DefaultApplicationDirectory] The path cannot point to the root directory or to the root of a
net share.
VERBOSE: [SRV01]: [[File]DefaultApplicationDirectory] The related file/directory is: \dscds1\dsc\Empty.
VERBOSE: [SRV01]: [[File]DefaultApplicationDirectory] The destination object was found and no action is required.
VERBOSE: [SRV01]: LCM: [ End Test ] [[File]DefaultApplicationDirectory] in 0.0098 seconds.
VERBOSE: [SRV01]: LCM: [ Skip Set ] [[File]DefaultApplicationDirectory]
VERBOSE: [SRV01]: LCM: [ End Resource ] [[File]DefaultApplicationDirectory]
VERBOSE: [SRV01]: LCM: [ Start Resource ] [[File]OctopusDeployTentacle]
VERBOSE: [SRV01]: LCM: [ Start Test ] [[File]OctopusDeployTentacle]
VERBOSE: [SRV01]: [[File]OctopusDeployTentacle] Building file list from cache.
VERBOSE: [SRV01]: [[File]OctopusDeployTentacle] The destination object was found and no action is required.
VERBOSE: [SRV01]: LCM: [ End Test ] [[File]OctopusDeployTentacle] in 0.1229 seconds.
VERBOSE: [SRV01]: LCM: [ Skip Set ] [[File]OctopusDeployTentacle]
VERBOSE: [SRV01]: LCM: [ End Resource ] [[File]OctopusDeployTentacle]
VERBOSE: [SRV01]: LCM: [ Start Resource ] [[File]OctopusDeployTentacleOriginalName]
VERBOSE: [SRV01]: LCM: [ Start Test ] [[File]OctopusDeployTentacleOriginalName]
VERBOSE: [SRV01]: [[File]OctopusDeployTentacleOriginalName] Building file list from cache.
VERBOSE: [SRV01]: [[File]OctopusDeployTentacleOriginalName] The destination object was found and no action is required
.
VERBOSE: [SRV01]: LCM: [ End Test ] [[File]OctopusDeployTentacleOriginalName] in 0.0119 seconds.
VERBOSE: [SRV01]: LCM: [ Skip Set ] [[File]OctopusDeployTentacleOriginalName]
VERBOSE: [SRV01]: LCM: [ End Resource ] [[File]OctopusDeployTentacleOriginalName]
VERBOSE: [SRV01]: LCM: [ Start Resource ] [[cTentacleAgent]OctopusDeployTentacleConfiguration]
VERBOSE: [SRV01]: LCM: [ Start Test ] [[cTentacleAgent]OctopusDeployTentacleConfiguration]
VERBOSE: [SRV01]: [[cTentacleAgent]OctopusDeployTentacleConfiguration] Checking if Tentacle is installed
VERBOSE: [SRV01]: [[cTentacleAgent]OctopusDeployTentacleConfiguration] Tentacle present: False
VERBOSE: [SRV01]: [[cTentacleAgent]OctopusDeployTentacleConfiguration] Checking for Windows Service: OctopusDeploy Ten
tacle
VERBOSE: [SRV01]: [[cTentacleAgent]OctopusDeployTentacleConfiguration] Windows service: Stopped
VERBOSE: [SRV01]: [[cTentacleAgent]OctopusDeployTentacleConfiguration] Since the Windows Service is still installed, t
he service is present
VERBOSE: [SRV01]: [[cTentacleAgent]OctopusDeployTentacleConfiguration] Ensure: Present vs. Present = True
VERBOSE: [SRV01]: [[cTentacleAgent]OctopusDeployTentacleConfiguration] State: Stopped vs. Started = False
VERBOSE: [SRV01]: LCM: [ End Test ] [[cTentacleAgent]OctopusDeployTentacleConfiguration] in 0.0092 seconds.
VERBOSE: [SRV01]: LCM: [ Start Set ] [[cTentacleAgent]OctopusDeployTentacleConfiguration]
VERBOSE: [SRV01]: [[cTentacleAgent]OctopusDeployTentacleConfiguration] Checking if Tentacle is installed
VERBOSE: [SRV01]: [[cTentacleAgent]OctopusDeployTentacleConfiguration] Tentacle present: False
VERBOSE: [SRV01]: [[cTentacleAgent]OctopusDeployTentacleConfiguration] Checking for Windows Service: OctopusDeploy Ten
tacle
VERBOSE: [SRV01]: [[cTentacleAgent]OctopusDeployTentacleConfiguration] Windows service: Stopped
VERBOSE: [SRV01]: [[cTentacleAgent]OctopusDeployTentacleConfiguration] Since the Windows Service is still installed, t
he service is present
VERBOSE: [SRV01]: [[cTentacleAgent]OctopusDeployTentacleConfiguration] Configuring Tentacle…
VERBOSE: [SRV01]: [[cTentacleAgent]OctopusDeployTentacleConfiguration] Starting OctopusDeploy Tentacle
VERBOSE: [SRV01]: [[cTentacleAgent]OctopusDeployTentacleConfiguration] Finished
Service ‘OctopusDeploy Tentacle (OctopusDeploy Tentacle)’ cannot be started due to the following error: Cannot start service OctopusDeploy
Tentacle on computer ‘.’.
+ CategoryInfo : OpenError: (:slight_smile: [], CimException
+ FullyQualifiedErrorId : CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand
+ PSComputerName : SRV01

VERBOSE: [SRV01]: LCM: [ End Set ] [[cTentacleAgent]OctopusDeployTentacleConfiguration] in 0.4501 seconds.
The PowerShell DSC resource cTentacleAgent threw one or more non-terminating errors while running the Set-TargetResource functionality. These
errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
+ CategoryInfo : InvalidOperation: (:slight_smile: [], CimException
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider
+ PSComputerName : SRV01

The SendConfigurationApply function did not succeed.
+ CategoryInfo : NotSpecified: (root/Microsoft/…gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 1
+ PSComputerName : SRV01

VERBOSE: Operation ‘Invoke CimMethod’ complete.
VERBOSE: Time taken for configuration job to complete is 0.698 seconds

So in fact the MSI installation fails, nothing is installed whatsoever.
The Windows eventlog doesn’t say anything useful except for that a non-terminating error occurred in Set-TargetResource.

Both servers are member of the same domain, I’m using AD integration and made the domain administrator account the Octopus Deploy administrator. This account is local administrator on all my servers (Windows Server 2012 R2).

I’m kinda at a loss here… any and all assistance is appreciated :slight_smile:

Jeff.

Nevermind… “solved” it by installing Tentacle as a package instead of letting the Tentacle DSC resource do it and manipulate it by placing the Tentacle MSI in C:\Octopus so that it won’t try and download the latest version.
Code I ended up using:

configuration OctopusDeployTentacleConfiguration {
param (
[parameter(Mandatory=$true,Position=1)][string[]]$ComputerName,
[parameter(Mandatory=$true,Position=2)][ValidateSet(‘Development’,‘Test’,‘Acceptation’,‘Production’)]$Environment
)
Import-DscResource -ModuleName OctopusDSC
Node $ComputerName {
Package OctopusDeployTentacle {
Name = 'Octopus Deploy Tentacle’
Ensure = 'Present’
Path = '\dscdc1\dsc\OctopusDeploy\OctopusTentacle\Octopus.Tentacle.2.5.8.447-x64.msi’
ProductId = ‘44CE5578-8416-466E-85B9-5ABD3C68B060’
}
cTentacleAgent OctopusDeployTentacleConfiguration {
Ensure = "Present"
State = "Started"
Name = "Tentacle"
ApiKey = "4F17735C3A8FEFB12E367BD684B484715E0029ED"
OctopusServerUrl = "http://DSCDC1.LAN/"
Environments = @(“Development”)
Roles = @(“Web-Server”)
ListenPort = 10933
DefaultApplicationDirectory = "C:\Octopus\Applications"
DependsOn = “[Package]OctopusDeployTentacle”
}
}
}
OctopusDeployTentacleConfiguration -ComputerName ‘SRV01’ -OutputPath ‘C:\dsc\Staging\OctopusDeployTentacleConfiguration’ -Environment 'Development’
Start-DscConfiguration -Path ‘C:\dsc\Staging\OctopusDeployTentacleConfiguration’ -Wait -Verbose -Force