Skip to content

Commit

Permalink
Create initial provisioning script to install Octopus Deploy server.
Browse files Browse the repository at this point in the history
Relates to #3.
  • Loading branch information
tintoy committed Jun 25, 2017
1 parent 3b912fa commit 28e6e3f
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 3 deletions.
2 changes: 1 addition & 1 deletion acc-test-environment/database.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resource "azurerm_sql_server" "primary" {
version = "12.0"

administrator_login = "${var.admin_username}"
administrator_login_password = "${var.initial_admin_password}"
administrator_login_password = "${var.admin_password}"
}

# Database used by the environment's Octopus server
Expand Down
2 changes: 1 addition & 1 deletion acc-test-environment/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ variable "octo_vm_instance_type" { default = "Standard_A3" }
variable "admin_username" { default = "octo-admin" }

# The administrator password for the Octopus and SQL servers.
variable "initial_admin_password" { }
variable "admin_password" { }
45 changes: 45 additions & 0 deletions acc-test-environment/scripts/Provision-OctopusServer.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Param(
[Parameter(Mandatory = $true)]
[string] $SqlServerHost,

[Parameter(Mandatory = $true)]
[string] $Database,

[Parameter(Mandatory = $true)]
[string] $User,

[Parameter(Mandatory = $true)]
[string] $Password
)

Import-Module PowerShellGet
Install-Module OctopusDSC -Force
Import-Module OctopusDSC

Configuration Octopus {
Import-DscResource -Module OctopusDSC

Node "localhost" {
cOctopusServer OctopusServer {
Ensure = "present"
State = "started"

Name = "OctopusServer"

WebListenPrefix = "http://localhost:9081"
SqlDbConnectionString = "Server=$SqlServerHost;Database=$Database;UID=$User;PWD=$Password"

OctopusAdminUsername = $User
OctopusAdminPassword = $Password

# AllowUpgradeCheck = $false
# AllowCollectionOfAnonymousUsageStatistics = $false
# ForceSSL = $false
# ListenPort = 10943
}
}
}
Octopus

Start-DscConfiguration .\Octopus -Verbose -Wait
Test-DscConfiguration
22 changes: 21 additions & 1 deletion acc-test-environment/vm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ resource "azurerm_virtual_machine" "octo" {
os_profile {
computer_name = "octo-${var.uniqueness_key}"
admin_username = "${var.admin_username}"
admin_password = "${var.initial_admin_password}"
admin_password = "${var.admin_password}"
}

os_profile_windows_config {
Expand All @@ -42,4 +42,24 @@ resource "azurerm_virtual_machine" "octo" {
}
}

# Install Octopus Deploy
resource "null_resource" "octo_provisioning" {
provisioner "remote_exec" {
script = "scripts/Provision-OctopusServer.ps1"

connection {
type = "winrm"
host = "${azurerm_public_ip.octo.ip_address}"
user = "${var.admin_username}"
password = "${var.admin_password}"
}
}

depends_on = [
"azurerm_virtual_machine.octo",
"azurerm_public_ip.octo",
"azurerm_network_security_group.default"
]
}

# TODO: Add provisioner to install and configure Octopus Server.

0 comments on commit 28e6e3f

Please sign in to comment.