Coder Social home page Coder Social logo

octopusdsc's People

Contributors

benpearce1 avatar chrisumitratech avatar cvandal avatar dalmirog avatar damovisa avatar deanmalone avatar dependabot[bot] avatar hansmelin avatar hnrkndrssn avatar jm0nty avatar matt-richardson avatar mattpolson avatar michaelnoonan avatar musashi178 avatar n-lson avatar nickjosevski avatar oxtn avatar paulegradie avatar paulmarsy avatar paulstovell avatar saasops avatar simongh avatar stopthatastronaut avatar twerthi avatar veochen-octopus avatar zentron avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

octopusdsc's Issues

Resource always assumes public ip

The Set-TargetResource always assumes the octopus server should talk to the tentacle using the tentacle's public ip. In my experience, this is wrong 80% of the time. This setting needs to be configurable.

SSL implementation seems incomplete

There doesn't seem to be an option to add an HTTPS listener to complement the ForceSSL option. Such an option should allow you to specify the certificate thumbprint as well as giving the option of creating a self-signed certificate.

ApiKey and octopusServerUrl Mandatory

Hi!

In cTentacleAgent.psm1 and the function New-Tentacle the parameters $apiKey and $octopusServerUrl are mandatory and it seems to me they should not be?
I assume that those parameters are only really used if $RegisterWithServer = $true ?

And if I set $RegisterWithServer = $false and omit $apikey and $octopusServerUrl from cTentacleAgent properties, the LCM will exit with the error:
VERBOSE: [$Name]: [[cTentacleAgent]OctopusTentacle] Installing Tentacle...
Cannot bind argument to parameter 'apiKey' because it is an empty string.
+ CategoryInfo : InvalidData: (:) [], CimException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,New-Tentacle
+ PSComputerName : localhost

However, if I change the param-block to:

[Parameter(Mandatory = $True)]
        [string]$name,
        [Parameter(Mandatory = $False)]
        [string]$apiKey,
        [Parameter(Mandatory = $False)]
        [string]$octopusServerUrl

The configuration is applied successfully.

Set-ServiceCredential not called?

Hi!

Sorry if this should not be posted as an issue since I've solved it for myself, new to GIT...

I'm trying to install a new tentacle with service credentials (encrypted with certificate), but I'm running in to a problem.
The function Set-ServiceCredential is never called in cTentacleAgent.psm1.

I've added this part to Set-TargetResource to make it work:

    if ($TentacleServiceCredential)
    {
        Write-Verbose "Settings servicecredentials."
        Set-ServiceCredential -Name $name -credential $TentacleServiceCredential
        Write-Verbose "Restarting $serviceName with new credentials."
        Restart-Service -Name $serviceName
    }
    else {
        Write-Verbose "Skipping service credentials as no credentials givven."
    }

And this seems to have done the trick! :)

Deployment fails

I get an error when I try to deploy Tentacle client using DSC.
I'm running Powershell 5 on both servers - push server and the end node. Both are Server 2012 r2

Error:
PowerShell DSC resource cTentacleAgent failed to execute Set-TargetResource functionality with error message: Command returned exit code 100

Was unable to access this log: C:\Windows\system32\config\systemprofile\AppData\Local\Octopus\Logs

Config:

Configuration SampleConfig
{
    param ($ApiKey, $OctopusServerUrl, $Environments, $Roles, $ListenPort)

    Import-DscResource -Module OctopusDSC

    Node "Test-dsc01"
    {
        cTentacleAgent OctopusTentacle 
        { 
            Ensure = "Present"; 
            State = "Started"; 

            # Tentacle instance name. Leave it as 'Tentacle' unless you have more 
            # than one instance
            Name = "Tentacle";

            # Registration - all parameters required
            ApiKey = $ApiKey;
            OctopusServerUrl = $OctopusServerUrl;
            Environments = $Environments;
            Roles = $Roles;

            # Optional settings
            ListenPort = $ListenPort;
            DefaultApplicationDirectory = "C:\Octopus"
        }
    }
}

SampleConfig -OutputPath C:\DSC\Config\ -ApiKey "API-0E2B40B5BB9E6DEEB45DE80F8FB0403" -OctopusServerUrl "http://octopus.tnf.local/" -Environments @("TNF Dev (QA)") -Roles @("web-server", "app-server") -ListenPort 10933

Start-DscConfiguration -Path C:\DSC\Config -Verbose -wait

Verbose output:

Mode                LastWriteTime         Length Name                                                                                                              
----                -------------         ------ ----                                                                                                              
-a----       22/07/2015   1:19 PM           2436 Test-dsc01.mof                                                                                                    
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'nam
espaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer TEST-DSC03 with user sid S-1-5-21-2352268633-497850565-3880790766-1132.
VERBOSE: [TEST-DSC01]: LCM:  [ Start  Set      ]
VERBOSE: [TEST-DSC01]: LCM:  [ Start  Resource ]  [[cTentacleAgent]OctopusTentacle]
VERBOSE: [TEST-DSC01]: LCM:  [ Start  Test     ]  [[cTentacleAgent]OctopusTentacle]
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Checking if Tentacle is installed
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Tentacle present: True
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Checking for Windows Service: OctopusDeploy Tentacle
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Windows service: Not installed
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Ensure: Absent vs. Present = False
VERBOSE: [TEST-DSC01]: LCM:  [ End    Test     ]  [[cTentacleAgent]OctopusTentacle]  in 0.1410 seconds.
VERBOSE: [TEST-DSC01]: LCM:  [ Start  Set      ]  [[cTentacleAgent]OctopusTentacle]
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Checking if Tentacle is installed
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Tentacle present: True
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Checking for Windows Service: OctopusDeploy Tentacle
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Windows service: Not installed
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Configuring Tentacle...
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Installing Tentacle...
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Beginning Tentacle installation
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Downloading latest Octopus Tentacle MSI from http://octopusdeploy.com/downloads/
latest/OctopusTentacle64 to C:\Octopus\Tentacle.msi
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Downloading http://octopusdeploy.com/downloads/latest/OctopusTentacle64 to C:\Oc
topus\Tentacle.msi
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Installing MSI...
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Tentacle MSI installer returned exit code 0
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Open port 10933 on Windows Firewall
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Ok.
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Getting public IP address
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Public IP address: 54.76.147.171
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Configuring and registering Tentacle
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Octopus Deploy: Tentacle version 3.0.3.2084
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Creating empty configuration file: C:\Octopus\Tentacle\Tentacle.config
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Saving instance: Tentacle
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Octopus Deploy: Tentacle version 3.0.3.2084
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Home directory set to: C:\Octopus
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Octopus Deploy: Tentacle version 3.0.3.2084
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Application directory set to: C:\Octopus
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Octopus Deploy: Tentacle version 3.0.3.2084
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Services listen port: 10933
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Octopus Deploy: Tentacle version 3.0.3.2084
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] A new certificate has been generated and installed. Thumbprint:
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] CD306F05A0A435826B50E416D0552B10CAF2BC94
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Octopus Deploy: Tentacle version 3.0.3.2084
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Service installed
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Registering with arguments: register-with --instance Tentacle --server http://oc
topus.tnf.local/ --name TEST-DSC01 --publicHostName 54.76.147.171 --apiKey API-5C0E2B40BB9E6DEEB45DE80F8FB0403 --comms-style TentaclePassive --force --console 
--environment TNF Dev (QA) --role web-server --role app-server
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Octopus Deploy: Tentacle version 3.0.3.2084
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] -------------------------------------------------------------------------------
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Error: You must be logged in to perform this action. Please provide a valid API 
key or log in again.
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] -------------------------------------------------------------------------------
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Full error details are available in the log files.
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] At: C:\Windows\system32\config\systemprofile\AppData\Local\Octopus\Logs
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] You must be logged in to perform this action. Please provide a valid API key or 
log in again.
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle] Octopus.Client.Exceptions.OctopusSecurityException: You must be logged in to per
form this action. Please provide a valid API key or log in again.
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle]    at Octopus.Client.OctopusClient.DispatchRequest[TResponseResource](OctopusReq
uest request, Boolean readResponse) in y:\work\refs\heads\master\source\Octopus.Client\OctopusClient.cs:line 450
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle]    at Octopus.Client.OctopusClient.Get[TResource](String path, Object pathParame
ters) in y:\work\refs\heads\master\source\Octopus.Client\OctopusClient.cs:line 83
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle]    at Octopus.Client.OctopusRepository.CertificateRepository.GetOctopusCertifica
te() in y:\work\refs\heads\master\source\Octopus.Client\OctopusRepository.cs:line 649
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle]    at Octopus.Tentacle.Commands.RegisterMachineCommand.Start() in y:\work\refs\h
eads\master\source\Octopus.Tentacle\Commands\RegisterMachineCommand.cs:line 76
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle]    at Octopus.Shared.Startup.AbstractCommand.Octopus.Shared.Startup.ICommand.Sta
rt(String[] commandLineArguments, ICommandRuntime commandRuntime, OptionSet commonOptions) in y:\work\refs\heads\master\source\Octopus.Shared\Startup\AbstractComman
d.cs:line 57
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle]    at Octopus.Shared.Startup.ConsoleHost.Run(Action`1 start, Action shutdown) in
 y:\work\refs\heads\master\source\Octopus.Shared\Startup\ConsoleHost.cs:line 81
VERBOSE: [TEST-DSC01]:                            [[cTentacleAgent]OctopusTentacle]    at Octopus.Shared.Startup.OctopusProgram.Run() in y:\work\refs\heads\master\s
ource\Octopus.Shared\Startup\OctopusProgram.cs:line 73
VERBOSE: [TEST-DSC01]: LCM:  [ End    Set      ]  [[cTentacleAgent]OctopusTentacle]  in 19.8750 seconds.
PowerShell DSC resource cTentacleAgent  failed to execute Set-TargetResource functionality with error message: Command returned exit code 100 
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : Test-dsc01

VERBOSE: [TEST-DSC01]: LCM:  [ End    Set      ]
The SendConfigurationApply function did not succeed.
    + CategoryInfo          : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 1
    + PSComputerName        : Test-dsc01

VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 20.846 seconds

Running twice with 'Absent' throws an error

It should just quietly go about its day rather than throwing an exception.

Start-DscConfiguration -Wait -Force -path $env:tmp\9 
PowerShell DSC resource cOctopusServer  failed to execute Set-TargetResource functionality with error message: Octopus.Server.exe path 'C:\Program Files\Octopus Deploy\Octopus\Octopus.Server.exe' does not exist. 
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure

Logged as a placeholder for after the big username/password merge

DSC should check for (and install?) .net 4.5.1

Octopus Server requires 4.5.1, and if its not installed, the DSC fails with an unclear message.

[[cOctopusServer]OctopusServer] Beginning installation
[[cOctopusServer]OctopusServer] Downloading https://octopus.com/downloads/latest/WindowsX64/OctopusServer to C:\Octopus\Octopus-x64.msi
[[cOctopusServer]OctopusServer] Installing MSI...
[[cOctopusServer]OctopusServer] MSI installer returned exit code 1603
[[cOctopusServer]OctopusServer]  in 3.8460 seconds.

DSC should check for .net 4.5.1

Open question: Should it auto-install 4.5.1?

cOctopusServerUsernamePasswordAuthentication doesn't support non-default instance

Problem

I get the following error when using OctopusDSC to ensure a named instance of Octopus Server is present and running with the InstanceName OctopusDSC.

This works if I use a default instance.

Tested with Octopus 3.15 release candidate.

VERBOSE: [MICHAELNOON1449]: LCM:  [ Start  Resource ]  [[cOctopusServerUsernamePasswordAuthentication]Enable Username/Passwor
VERBOSE: [MICHAELNOON1449]: LCM:  [ Start  Test     ]  [[cOctopusServerUsernamePasswordAuthentication]Enable Username/Passwor
There is no default instance of OctopusServer configured on this machine. Please pass --instance=INSTANCENAME when invoking t
Available instances: OctopusDSC.
    + CategoryInfo          : NotSpecified: (There is no def...es: OctopusDSC.:) [], CimException
    + FullyQualifiedErrorId : NativeCommandError
    + PSComputerName        : localhost

VERBOSE: [MICHAELNOON1449]:                            [[cOctopusServerUsernamePasswordAuthentication]Enable Username/Passwor
ches the requested value 'OctopusDSC'
VERBOSE: [MICHAELNOON1449]:                            [[cOctopusServerUsernamePasswordAuthentication]Enable Username/Passwor
Enabled' with value '' mismatched the specified value 'True'
VERBOSE: [MICHAELNOON1449]: LCM:  [ End    Test     ]  [[cOctopusServerUsernamePasswordAuthentication]Enable Username/Passwor
The PowerShell DSC resource '[cOctopusServerUsernamePasswordAuthentication]Enable Username/Password Auth' with SourceInfo

Possible Root Cause

https://github.com/OctopusDeploy/OctopusDSC/blob/master/OctopusDSC/DSCResources/cOctopusServerUsernamePasswordAuthentication/cOctopusServerUsernamePasswordAuthentication.psm1#L88

My sample DSC script

Configuration SampleConfig
{
    Import-DscResource -Module OctopusDSC

    Node "localhost"
    {
        cOctopusServer OctopusServer
        {
            Ensure = "Present"
            State = "Started"

            # Server instance name. Leave it as 'OctopusServer' unless you have more than one instance
            Name = "OctopusDSC"

            # The url that Octopus will listen on
            WebListenPrefix = "http://localhost:8065"

            SqlDbConnectionString = "Server=(local)\SQLEXPRESS;Database=OctopusDSC;Trusted_Connection=True;"

            # The admin user to create
            OctopusAdminUsername = "admin"
            OctopusAdminPassword = "Password01!"

            # optional parameters
            AllowUpgradeCheck = $false
            AllowCollectionOfAnonymousUsageStatistics = $false
            ForceSSL = $false
            ListenPort = 10943
            DownloadUrl = "http://localhost/Octopus.3.14.1593-enh-consolelove0081-x64.msi"
        }

        cOctopusServerUsernamePasswordAuthentication "Enable Username/Password Auth"
        {
            InstanceName = "OctopusDSC"
            Enabled = $true
        }
    }
}

# Execute the configuration above to create a mof file
SampleConfig

# Run the configuration
Start-DscConfiguration -Path ".\SampleConfig" -Verbose -wait -force

# Test the configuration ran successfully
Test-DscConfiguration

Polling for server assumes weblistenprefix is separated by semi-colons

The code that polls to make sure the octopus server is up assumes that the weblistenprefix is separated by semi-colons. If it is separated by commas, it tries to poll http://localhost:81,https://publicip.example.com, which obviously doesn't work so well.

We need to split on both commas and semi-colons.

While we are there, it also seems that if the timeout is reached, it doesn't abort, it just assumes that everything is okay and moves on. It should throw an exception.

cTentacleAgent install fails, unable to find Octopus.DSC.installstate

From the logs, it looks like there may be a hardcoded location to find the file after the .MSI is done installing. The installation completes successfully and it successfully connects to the Octopus server.

VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' =
SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' =
root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer DEL-Z122090 with user sid
S-1-5-21-1844237615-1844823847-839522115-74788.
VERBOSE: [DEL-Z122090]: LCM: [ Start Set ]
VERBOSE: [DEL-Z122090]: LCM: [ Start Resource ] [[cTentacleAgent]OctopusTentacle]
VERBOSE: [DEL-Z122090]: LCM: [ Start Test ] [[cTentacleAgent]OctopusTentacle]
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Checking if Tentacle is installed
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Tentacle present: False
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Checking for Windows Service:
OctopusDeploy Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Windows service: Not installed
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Ensure: Absent vs. Present = False
VERBOSE: [DEL-Z122090]: LCM: [ End Test ] [[cTentacleAgent]OctopusTentacle] in 0.6560 seconds.
VERBOSE: [DEL-Z122090]: LCM: [ Start Set ] [[cTentacleAgent]OctopusTentacle]
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Checking if Tentacle is installed
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Tentacle present: False
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Checking for Windows Service:
OctopusDeploy Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Windows service: Not installed
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Configuring Tentacle...
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Installing Tentacle...
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Beginning Tentacle installation
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Downloading Octopus Tentacle MSI
from http://octopusdeploy.com/downloads/latest/OctopusTentacle64 to e:\Octopus\Tentacle.msi
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Downloading
http://octopusdeploy.com/downloads/latest/OctopusTentacle64 to e:\Octopus\Tentacle.msi
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Installing MSI...
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Tentacle MSI installer returned
exit code 0
Could not find a part of the path 'C:\Octopus\Octopus.DSC.installstate'.
+ CategoryInfo : ObjectNotFound: (C:\Octopus\Octopus.DSC.installstate:) [], CimException
+ FullyQualifiedErrorId : GetContentWriterDirectoryNotFoundError,Microsoft.PowerShell.Commands.SetContentCommand
+ PSComputerName : localhost

VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Open port 10933 on Windows
Firewall
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Ok.
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Configuring and registering
Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Tentacle configuration set as
e:\Octopus\Tentacle\Tentacle.config
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Octopus Deploy: Tentacle version
3.12.6 (3.12.6+Branch.master.Sha.5fd77c79b36c7f0307dd3d34b855749a23564bce) instance Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Environment Information:
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] OperatingSystem: Microsoft
Windows NT 6.2.9200.0
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] OsBitVersion: x64
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Is64BitProcess: True
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] CurrentUser: NT AUTHORITY\SYSTEM
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] MachineName: DEL-Z122090
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] ProcessorCount: 4
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] CurrentDirectory: C:\Program
Files\Octopus Deploy\Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] TempDirectory: C:\Windows\TEMP
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] HostProcessName: Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Saving instance: Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Octopus Deploy: Tentacle version
3.12.6 (3.12.6+Branch.master.Sha.5fd77c79b36c7f0307dd3d34b855749a23564bce) instance Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Environment Information:
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] OperatingSystem: Microsoft
Windows NT 6.2.9200.0
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] OsBitVersion: x64
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Is64BitProcess: True
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] CurrentUser: NT AUTHORITY\SYSTEM
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] MachineName: DEL-Z122090
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] ProcessorCount: 4
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] CurrentDirectory: C:\Program
Files\Octopus Deploy\Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] TempDirectory: C:\Windows\TEMP
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] HostProcessName: Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Home directory set to: e:\Octopus
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Octopus Deploy: Tentacle version
3.12.6 (3.12.6+Branch.master.Sha.5fd77c79b36c7f0307dd3d34b855749a23564bce) instance Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Environment Information:
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] OperatingSystem: Microsoft
Windows NT 6.2.9200.0
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] OsBitVersion: x64
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Is64BitProcess: True
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] CurrentUser: NT AUTHORITY\SYSTEM
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] MachineName: DEL-Z122090
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] ProcessorCount: 4
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] CurrentDirectory: C:\Program
Files\Octopus Deploy\Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] TempDirectory: C:\Windows\TEMP
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] HostProcessName: Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Application directory set to:
e:\Temp
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Octopus Deploy: Tentacle version
3.12.6 (3.12.6+Branch.master.Sha.5fd77c79b36c7f0307dd3d34b855749a23564bce) instance Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Environment Information:
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] OperatingSystem: Microsoft
Windows NT 6.2.9200.0
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] OsBitVersion: x64
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Is64BitProcess: True
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] CurrentUser: NT AUTHORITY\SYSTEM
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] MachineName: DEL-Z122090
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] ProcessorCount: 4
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] CurrentDirectory: C:\Program
Files\Octopus Deploy\Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] TempDirectory: C:\Windows\TEMP
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] HostProcessName: Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] A new certificate has been
generated and installed. Thumbprint:
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle]
590847334942A318B54C02ECB965C091450393F3
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Octopus Deploy: Tentacle version
3.12.6 (3.12.6+Branch.master.Sha.5fd77c79b36c7f0307dd3d34b855749a23564bce) instance Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Environment Information:
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] OperatingSystem: Microsoft
Windows NT 6.2.9200.0
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] OsBitVersion: x64
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Is64BitProcess: True
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] CurrentUser: NT AUTHORITY\SYSTEM
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] MachineName: DEL-Z122090
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] ProcessorCount: 4
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] CurrentDirectory: C:\Program
Files\Octopus Deploy\Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] TempDirectory: C:\Windows\TEMP
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] HostProcessName: Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Services listen port: 10933
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Getting public IP address
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] GET https://api.ipify.org/ with
0-byte payload
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] received 12-byte response of
content type text/plain
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Public host name: 198.238.3.44
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Octopus Deploy: Tentacle version
3.12.6 (3.12.6+Branch.master.Sha.5fd77c79b36c7f0307dd3d34b855749a23564bce) instance Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Environment Information:
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] OperatingSystem: Microsoft
Windows NT 6.2.9200.0
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] OsBitVersion: x64
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Is64BitProcess: True
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] CurrentUser: NT AUTHORITY\SYSTEM
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] MachineName: DEL-Z122090
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] ProcessorCount: 4
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] CurrentDirectory: C:\Program
Files\Octopus Deploy\Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] TempDirectory: C:\Windows\TEMP
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] HostProcessName: Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Service installed
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Registering with arguments:
register-with --instance Tentacle --server http://MyOctoServer --name MachineName --apiKey
API-KEY --force --console --comms-style TentaclePassive --publicHostName 198.238.3.44
--environment ShawnTest --role Database
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Octopus Deploy: Tentacle version
3.12.6 (3.12.6+Branch.master.Sha.5fd77c79b36c7f0307dd3d34b855749a23564bce) instance Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Environment Information:
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] OperatingSystem: Microsoft
Windows NT 6.2.9200.0
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] OsBitVersion: x64
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Is64BitProcess: True
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] CurrentUser: NT AUTHORITY\SYSTEM
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] MachineName: DEL-Z122090
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] ProcessorCount: 4
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] CurrentDirectory: C:\Program
Files\Octopus Deploy\Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] TempDirectory: C:\Windows\TEMP
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] HostProcessName: Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Registering the tentacle with the
server at http://deploy.del.wa.gov/
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Machine registered successfully
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Tentacle commands complete
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Tentacle installed!
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Starting OctopusDeploy Tentacle
VERBOSE: [DEL-Z122090]: [[cTentacleAgent]OctopusTentacle] Finished
VERBOSE: [DEL-Z122090]: LCM: [ End Set ] [[cTentacleAgent]OctopusTentacle] in 14.6930 seconds.
The PowerShell DSC resource '[cTentacleAgent]OctopusTentacle' with SourceInfo
'E:\Development-Active\InstallTentacle.ps1::24::3::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: (:) [], CimException
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider
+ PSComputerName : localhost

VERBOSE: [DEL-Z122090]: LCM: [ End Set ]
The SendConfigurationApply function did not succeed.
+ CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 1
+ PSComputerName : localhost

VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 16.019 seconds

Here is my configuration

Param($OctopusAPIKey,
$OctopusRoles,
$OctopusEnvironments,
$OctopusServerUrl,
$TempPath
)

configure Ocotpus Deploy

Configuration OctopusSetup
{
# define parameters
Param($OctopusAPIKey,
$OctopusRoles,
$OctopusEnvironments,
$OctopusServerUrl
)

# import necessary resources
Import-DscResource -Module OctopusDSC

# create localhost configuration node
Node "localhost"
{
	cTentacleAgent OctopusTentacle
	{
		Name = "Tentacle"
        DisplayName = $env:COMPUTERNAME
        Ensure = "Present"
		State = "Started"
		ApiKey = $OctopusAPIKey
		OctopusServerUrl = $OctopusServerUrl
		Environments = $OctopusEnvironments
		Roles = $OctopusRoles
        CommunicationMode = "Listen"
        DefaultApplicationDirectory = "e:\Temp"
        TentacleHomeDirectory = "e:\Octopus"
	}
}

}

run configureation

OctopusSetup -OctopusAPIKey $OctopusAPIKey -OctopusRoles $OctopusRoles -OctopusEnvironments $OctopusEnvironments -OctopusServerUrl $OctopusServerUrl -OutputPath $TempPath

start the configuration

Start-DscConfiguration -Path $TempPath -Verbose -Wait

Tentacle drift detection

It seems that The resource will only update if Ensure is different from the current state (eg, install if missing).
It does not perform drift detection if for example if the value of environment has changed.

Octopus Server resource only supports one instance

Tentacle watchdog support

Octopus Deploy v3.7.17 added a feature to create a scheduled task to make sure the Tentacle was running (the "watchdog"): OctopusDeploy/Issues#3067

It doesn't look like this is currently supported. Would you accept a PR to add support for that to New-Tentacle()?

Tenants and Tenant Tags functionality

The ability to specify a tenant and tenant tag functionality was missing in the Tentacle Agent DSC files. I needed it pretty urgently so wrote the code this weekend and was wanting to do a pull request. I've configured the fields as optional so if you don't specify anything the switches don't get passed into the tentacle execution allow it to be backwards compatible.

I won't get a chance to spin vagrant up for a week or so but wanted to know if you'd be interested in the pull request sooner? I've already tested it and using in a deployment with both tags defined and undefined.

The code is in https://github.com/mb290/OctopusDSC/tree/master/OctopusDSC/DSCResources/cTentacleAgent already if you want to take a look

Add script to install module programmatically

I just created this and it seems to work:

if (-not (Test-Path "C:\Program Files\WindowsPowerShell\Modules\OctopusDSC")) {
    mkdir c:\temp -ErrorAction SilentlyContinue | Out-Null
    $client = new-object system.Net.Webclient
    $client.DownloadFile("https://github.com/OctopusDeploy/OctopusDSC/archive/master.zip","c:\temp\octopusdsc.zip")
    Add-Type -AssemblyName System.IO.Compression.FileSystem
    [System.IO.Compression.ZipFile]::ExtractToDirectory("c:\temp\octopusdsc.zip", "c:\temp")
    cp -Recurse C:\temp\OctopusDSC-master\OctopusDSC "C:\Program Files\WindowsPowerShell\Modules\OctopusDSC"
}

cOctopusSeqLogger needs stronger parameter validation

Especially around the Properties hashtable, as an error here can result in a rather opaque error message

ConvertTo-MOFInstance : System.Management.Automation.RuntimeException error processing property 'Properties' OF TYPE
'cOctopusSeqLogger': You cannot call a method on a null-valued expression.
At [filenameredacted]:205 char:9
+   cOctopusSeqLogger
At line:341 char:16

which keyword issue

Not sure whether this is an issue or not - I can't work out where the 'which' command is supposed to come from? I keep getting the below error when trying to run build-hyperv.ps1. I've resorted to commenting the prerequisite checks for now.


& : The term 'which' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At C:\Users\mike\Downloads\OctopusDSC-master\Tests\powershell-helpers.ps1:32 char:5

  • & which $appName | Out-Null
  • ~~~~~
    
    • CategoryInfo : ObjectNotFound: (which:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

PSScriptAnalyzer issues

Hi OctopusDeploy,

Thank you for contributing to the PowerShell Gallery. We have analyzed your item, OctopusDSC 2.0.26 and found it contains the following issues:

PSAvoidUsingUserNameAndPassWordParams
cOctopusServer.psm1, line 24
Function 'Get-TargetResource' has both Username and Password parameters. Either set the type 
of the Password parameter to SecureString or replace the Username and Password parameters
with a Credential parameter of type PSCredential. If using a Credential parameter in PowerShell
4.0 or earlier, please define a credential transformation attribute after the PSCredential type 
attribute.
PSAvoidUsingUserNameAndPassWordParams
cOctopusServer.psm1, line 232
Function 'Set-TargetResource' has both Username and Password parameters. Either set the type 
of the Password parameter to SecureString or replace the Username and Password parameters 
with a Credential parameter of type PSCredential. If using a Credential parameter in PowerShell 
4.0 or earlier, please define a credential transformation attribute after the PSCredential type 
attribute.
PSAvoidUsingUserNameAndPassWordParams
cOctopusServer.psm1, line 635
Function 'Install-OctopusDeploy' has both Username and Password parameters. Either set the 
type of the Password parameter to SecureString or replace the Username and Password 
parameters with a Credential parameter of type PSCredential. If using a Credential parameter in 
PowerShell 4.0 or earlier, please define a credential transformation attribute after the 
PSCredential type attribute.
PSAvoidUsingUserNameAndPassWordParams
cOctopusServer.psm1, line 819
Function 'Test-TargetResource' has both Username and Password parameters. Either set the type 
of the Password parameter to SecureString or replace the Username and Password parameters 
with a Credential parameter of type PSCredential. If using a Credential parameter in PowerShell 
4.0 or earlier, please define a credential transformation attribute after the PSCredential type 
attribute.
PSAvoidUsingConvertToSecureStringWithPlainText
cOctopusServer.psm1, line 759
File 'cOctopusServer.psm1' uses ConvertTo-SecureString with plaintext. This will expose secure 
information. Encrypted standard strings should be used instead.

These errors were generated by PowerShell Script Analyzer, which can be found at http://www.powershellgallery.com/packages/PSScriptAnalyzer/.

Please resolve the issues and then republish your item to the gallery.

Your feedback about PowerShell Script Analyzer rules or the scan itself is welcome. If you feel that the rules applied in your item's scan results are too restrictive or can result in false hits, please file an issue at https://github.com/powershell/psscriptanalyzer/issues. Alternatively, you can respond to this thread and let us know.

If you would like to unlist your item until the issue is resolved, please follow these steps:

  1. Open http://www.powershellgallery.com, and sign in with your account credentials.
  2. Click your account name in the upper right of the page.
  3. Click Manage My Items.
  4. Next to the item you want to unlist, click the Unlist icon.

If you would like us to delete the original item version, respond and let us know. Otherwise, your item can remain unlisted.

Specify Installation Directory

It would be useful to be able to specify the installation/home directory. For example we're using Amazon EC2, Terraform and Ansible to deploy and provision our Octopus server. We would like to have the packages repository on an EBS volume that can be remounted when we teardown/recreate a new instance of the server.

Need a shared-resource for common functions

In particular, Dowload-File and Get-ODDSCParameter, as well as a few others. Centralising them will minimise the chance of a change drifting apart in different resoruces.

cTentacleAgent CustomPublicHostName is not a member

Is there a good place to see what properties are in which versions of this resource? I'm using what I believe is the latest version (2.0.57) and it does not contain CustomPublicHostName.

If I understand this property correctly I can use it to avoid disconnected Azure VMs with dynamic IPs that get re-assigned upon restart. This is the problem I'm currently trying to fix with this resource.

cTentacleAgent does not detect drift very well

If Get-TargetResource finds the Tentacle service to be present, it assumes that the tentacle is installed, which it may not be (as part of a reinstall etc). This ,coupled with the fact that uninstalling the tentacle doesn't seem to properly remove its own windows service, causes the dsc resource to incorrectly assume that the tentacle is already installed, when it very well may not be.

Feature usage statistics are not completely anonymous

The cOctopusServer resource has a parameter called AllowCollectionOfAnonymousUsageStatistics, that had a description of Allow anonymous reporting of usage statistics.

Unfortunately, due to a misunderstanding of the way the statistics collection worked, we claimed it was anonymous, when in fact it is possible for us to link this usage to your license key.

If this is enabled, we only collect aggregated feature usage statistics, such as number of projects, number of environments, number of machines etc. We never collect detailed information - things like names, descriptions, urls, variables etc are never collected. Please see our docs for full details on whats included.

If you wish to have your usage data deleted, please send us an email to [email protected] with the serial number from your license key and we will delete it from our database.

Solution

We are renaming the parameter to AllowCollectionOfUsageStatistics and bumping the version number to 4.x to signify a breaking change. This will allow users to take a considered approach to whether they are happy to continue with collection of usage stats.

We sincerely apologise for the mistake.

AutoLoginEnabled doesn't allow user change

AutoLoginEnabled is a bit of an odd property to have on the server - it should almost be its own DSC resource. Its a property that could be configured later via the UI and it could cause confusion if it gets reverted.

In the case of hosted Octopus, we don't really care what value the end user specifies for this, the DSC forces a value (the default - $false ) and therefore can overwrite something the user has changed.

source: https://trello.com/c/7mckQnfb/517-dsc-may-be-reverting-auth-config (private link)

Solution

We change the default value to $null and only attempt to apply it if its not null. It will need special handling in Test-TargetResource so that it ignores the difference between a "requested" value of $null and the actual value of $true or $false.

Replace ifconfig.me/ip call with something that is more stable

I am seeing frequent failures where Get-MyPublicIPAddress won't return an IP address, and therefore won't allow the machine to register properly with the Octopus Server.

I propose that Get-MyPublicIPAddress should use checkip.dyndns.com instead of ifconfig.me

$ip = $downloader.DownloadString("http://checkip.dyndns.com") -replace '[^\d\.]'

To troubleshoot the issues I was seeing after frequent failed registrations for machines I am deploying in Azure, I wrote this quick test to see if I would get any errors.

for($i=1; $i -le 10; $i++)
{
    Write-Host "Getting public IP address" 

    $downloader = new-object System.Net.WebClient 
    $ip = ""
    try
    {
        $ip = $downloader.DownloadString("http://ifconfig.me/ip") 
    }
    catch [system.exception]
    {
        $errorMessage = $_.Exception.Message
        Write-Host "Error: $errorMessage"
    }
    finally
    {
        Write-Host $ip  
        $downloader.Dispose();
    }
}

Every time I ran it, I would get at least one failure (generally more than one): "Unable to connect to the remote server". (your mileage may vary).

Defining CustomPublicHostName as a parameter does not work

hi,

I have a PowerShell script which uses a AWS ami to collect the public IP address then uses this to set the CustomPublicHostName. This throws an error. "A parameter cannot be found that matches parameter name 'CustomPublicHostName'."

[String]$machinename = Invoke-RestMethod -Uri http://169.254.169.254/latest/meta-data/public-ipv4

Configuration AppOctConfig
{
param ($ApiKey, $OctopusServerUrl, $Environments, $machinename)

Import-DscResource -Module OctopusDSC

Node "localhost"
{
    cTentacleAgent OctopusTentacle
    {
        Ensure = "Present"
        State = "Started"

        # Tentacle instance name. Leave it as 'Tentacle' unless you have more
        # than one instance
        Name = "Tentacle"

        OctopusServerUrl = $OctopusServerUrl
        ApiKey = $ApiKey
        Environments = $Environments
        Roles = 'ApplicationServer,DatabaseServer'

        # How Tentacle will communicate with the server
        CommunicationMode = 'Poll'
        ServerPort = '10943'
        PublicHostNameConfiguration = 'Custom'
        CustomPublicHostName = $machinename

        # Where Octopus should store its working files, logs, packages etc
        TentacleHomeDirectory = "C:\Octopus"

        # Where deployed applications will be installed by Octopus
        DefaultApplicationDirectory = "C:\Octopus\Applications"

    }
}

}

AppOctConfig -ApiKey $ApiKey -OctopusServerUrl $OctopusServerUrl -Environments $Environments -CustomPublicHostName $machinename

Support tentacle upgrades

Would be cool if there would be a parameter where you specify the exact version to install. The module should then also handle updates, when the installed version is lower than the specified version.

HSTS current state is not detected properly

When enabling HSTS on a server that is already configured with the requested settings:

    cOctopusServer "Configure Octopus Server" {
      Ensure                           = "Present"
...
      HSTSEnabled                      = $true
      HSTSMaxAge                       = 31536000
...
    }

image

The output shows:

(FOUND MISMATCH) Configuration parameter  'HSTSMaxAge' with value 'False' mismatched the specified value '31536000'
(FOUND MISMATCH) Configuration parameter  'HSTSEnabled' with value 'False' mismatched the specified value 'True'

The show-configuration outputs:

<set key="Octopus.WebPortal.HttpStrictTransportSecurityEnabled">True</set> 
<set key="Octopus.WebPortal.HttpStrictTransportSecurityMaxAge">31536000</set> 

it appears the code is checking the wrong parameters, and also doing a [System.Convert]::ToBoolean(...) on the max age.

Getting error at the end of the run

DSC seems to have configured Octopus, but at the very end of the run it throws this error at me:

VERBOSE: [IP-AC165207]:                            [[cOctopusServer]OctopusServer] Windows service: Running
VERBOSE: [IP-AC165207]:                            [[cOctopusServer]OctopusServer] Importing server configuration file from 'C:\Octopus\Octo
pusServer.config'
VERBOSE: [IP-AC165207]: LCM:  [ End    Test     ]  [[cOctopusServer]OctopusServer]  in 3.2470 seconds.
PowerShell DSC resource cOctopusServer  failed to execute Test-TargetResource functionality with error message: Invalid object passed in, 
':' or '}' expected. (1): { 
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : localhost
 
The SendConfigurationApply function did not succeed.
    + CategoryInfo          : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 1
    + PSComputerName        : localhost
 
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 3.377 seconds

I'm using powershell 4 and windows server 2012 r2

How can I fix it?

Get-DSCConfiguration fails with `AutoLoginEnabled key is not a valid property`

PS > Get-DscConfiguration

Get-DscConfiguration : The PowerShell DSC resource  returned results that are not valid from Get-TargetResource.
AutoLoginEnabled key is not a valid property in the corresponding DSC resource schema file. The results from
Get-TargetResource must be in a Hashtable format. The keys in the Hashtable must be the same as the properties in
corresponding DSC resource schema file.
At line:1 char:1
+ Get-DscConfiguration
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidResult: (MSFT_DSCLocalConfigurationManager:root/Microsoft/...gurationManager
   t-DscConfiguration], CimException
    + FullyQualifiedErrorId : GetOperationResultInvalidResultFormat,Get-DscConfiguration

The AutoLoginEnabled is missing from the mof file.

Feature request: add ServerThumbprint to cTentacleAgent

Using the cTentacleAgent_ListeningTentacle.psm1 example for a server that is not publicly available does not work.

I require a way to run the tentacle listening configuration in the same way as the app does (where it DOES NOT register with Octopus), i.e. this script:

cd "C:\Program Files\Octopus Deploy\Tentacle"
Tentacle.exe create-instance --instance "Tentacle" --config "C:\Octopus\Tentacle.config" --console
Tentacle.exe new-certificate --instance "Tentacle" --if-blank --console
Tentacle.exe configure --instance "Tentacle" --reset-trust --console
Tentacle.exe configure --instance "Tentacle" --home "C:\Octopus" --app "C:\Octopus\Applications" --port "10933" --console
Tentacle.exe configure --instance "Tentacle" --trust "THUMPRINT_GOES_HERE" --console
netsh advfirewall firewall add rule "name=Octopus Deploy Tentacle" dir=in action=allow protocol=TCP localport=10933
Tentacle.exe service --instance "Tentacle" --install --start --console

Roles to be dynamically set, at client runtime

Hey - not sure if this has been addressed and not sure how to request this properly.
Apologies if this is in completely wrong section!

But I need to be able to set the Octopus roles at runtime - i.e not a MOF creation, which currently seems to be the case.
Ideally, I have a seperate Script Resource that sets up the hashtable of roles I want, based on the client server the DSC Configuration is running on.
When it gets to the cTentacleAgent section, I'd like the "Roles = " part to dynamically read the hashtable variable from the Script Resource - is this possible?
Alternatively, I made the Script Resource write the Roles to a file and cTentacleAgent read from the file, but again it was looking to resolve the file content at MOF creation time, not at runtime, which is no good for me, as the Roles will only get decided on the client.
What can I do here?
Many thanks!

Current Pull Requests addressing Tentacle Url (Public IP)

I can see that all open pull requests address the same issue. That the Tentacle Url is registered with the public ip address. I have suggestion for a solution that could solve the scenarios.

  1. Introduce a new enum called TentacleUrlMode that will be used when resolving the URL. It could have following values:
    a. PublicIp - the same implementation as today
    b. FQDN - "$((Get-WmiObject win32_computersystem).DNSHostName).$((Get-WmiObject win32_computersystem).Domain)" - see http://stackoverflow.com/a/12268993
    c. ComputerName - $env:COMPUTERNAME
    d. CustomUrl
  2. If CustomUrl is set as TentacleUrlMode you could provide this in a new property

cTentacleAgent add support for proxy servers

Team, Great job on this DSC Module !!! Go Octopus !

Use case:

  • When tentacle is deployed to an environment where tentacle cannot directly communicate to the Octopus Server allow use of a proxy server.

Workaround:

  • API already supports ProxyId property. As a workaround we manually perform a POST to the API:
$header = @{ "X-Octopus-ApiKey" = "API-xxx" }

$body = @{ 
      Endpoint = @{
        CommunicationStyle = "TentaclePassive"
        Uri = "$tentacleURL`:$tentaclePort/"
        Thumbprint = $TentacleThumbprint
        ProxyId = $proxyId
      }
      EnvironmentIDs = @($environmentIds)
      MachinePolicyId = $machinePolicyId
      TenantIds = @($tenantIds)
      TenantTags = @($tenantTags)
      Name = $tentacleName
      Roles = @($octopusRole)
      Status = "Unknown"
      IsDisabled = $false
    } | ConvertTo-Json -Depth 10

Invoke-RestMethod "$octopusServerUrl/api/machines" -headers $header -Method Post -Body $body

Is this project abandoned ?

Hi

There are some Pull pending requests but no actions or comments. Is this project abandoned ?

Best regards

/Chi Thu Le

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.