Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to install module programmatically #14

Closed
robdmoore opened this issue Oct 6, 2015 · 2 comments
Closed

Add script to install module programmatically #14

robdmoore opened this issue Oct 6, 2015 · 2 comments

Comments

@robdmoore
Copy link

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"
}
@variableresistor
Copy link

Just throwing out there, the possibility of doing this via the cChoco DSC module. Simply import the module like you normally would, add a dependency on the Chocolatey installer, then add your OctopusDSC stuff:

configuration MyConfig
{
     [CmdletBinding()]
     param( )
    Import-DscResource -ModuleName PSDesiredStateConfiguration,cChoco

    Node "localhost"
    {
     cChocoPackageInstaller "Install_Octopus_Tentacle"
     {
          Name = "octopusdeploy.tentacle"
          Ensure = "Present"
	}

        cTentacleAgent OctopusTentacle
        {
            Ensure = "Present"
            State = "Started"
            DependsOn = "[cChocoPackageInstaller]Install_Octopus_Tentacle"

            # 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

            # How Tentacle will communicate with the server
            CommunicationMode = "Listen"
            ListenPort = $ListenPort

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

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

@matt-richardson
Copy link
Contributor

Thanks @robdmoore! Sorry it's taken so long. I've added some installation instructions to the main readme, and referenced this issue as well.

@ITGuyOU - I think I'm missing something, but why do you need to use the chocolatey package to install the Tentacle, when the DSC downloads and installs the Tentacle? @robdmoore's solution was about getting the DSC module onto the box, but from what I can tell, your script relies on the DSC module being installed already?

I'm gonna close this issue for now, but happy to keep the conversation going.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants