Compare commits

...

10 Commits

Author SHA1 Message Date
5f4e468b5e [skip ci] 2023-12-22 19:21:11 -06:00
a7e32b116a [skip ci] 2023-12-22 18:39:22 -06:00
788844bdd2 update 2023-12-22 16:56:33 -06:00
6e9f666f23 update 2023-12-22 16:45:17 -06:00
add2f7aa86 Update variables 2023-12-22 07:10:56 -06:00
90225bf7a4 Update deployment process 2023-12-20 11:57:20 -06:00
ef975f78b6 update 2023-12-20 11:02:31 -06:00
98c0044627 Update deployment process 2023-12-20 10:18:57 -06:00
ae92ffd157 update 2023-12-20 10:03:16 -06:00
c0fa247809 [skip ci] 2023-12-20 09:19:00 -06:00
6 changed files with 85 additions and 12 deletions

View File

@@ -26,4 +26,22 @@ step "approve-plan" {
Octopus.Action.Template.Version = "0"
}
}
}
step "infra" {
name = "Terraform Apply"
action "terraform-apply" {
properties = {
Octopus.Action.RunOnServer = "true"
Octopus.Action.Template.Id = "ActionTemplates-2"
Octopus.Action.Template.Version = "1"
}
worker_pool_variable = ""
container {
feed = "nexus"
image = "#{TF_CONTAINER}"
}
}
}

View File

@@ -1,7 +1,3 @@
variable "TF_INIT" {
value "-backend-config=\"address=https://gitlab.com/api/v4/projects/#{GITLAB_PROJECT_ID}/terraform/state/#{Octopus.Deployment.Tenant.Id}\" -backend-config=\"lock_address=https://gitlab.com/api/v4/projects/#{GITLAB_PROJECT_ID}/terraform/state/#{Octopus.Deployment.Tenant.Id}/lock\" -backend-config=\"unlock_address=https://gitlab.com/api/v4/projects/#{GITLAB_PROJECT_ID}/terraform/state/#{Octopus.Deployment.Tenant.Id}/lock\" -backend-config=\"username=developerdurp\" -backend-config=\"password=#{GITLAB_TOKEN}\" -backend-config=\"lock_method=POST\" -backend-config=\"unlock_method=DELETE\" -backend-config=\"retry_wait_min=5\"" {}
}
variable "GITLAB_PROJECT_ID" {
value "52820726" {}
}
@@ -11,5 +7,9 @@ variable "TF_PACKAGE" {
}
variable "TF_CONTAINER" {
value "octopusdeploy/worker-tools:6.1.0-ubuntu.22.04" {}
value "developerdurp/octopus-build-container:22.4.0" {}
}
variable "TF_INIT" {
value "-backend-config=\"address=https://gitlab.com/api/v4/projects/#{GITLAB_PROJECT_ID}/terraform/state/#{Octopus.Deployment.Tenant.Id}-#{Octopus.Environment.Name}\" -backend-config=\"lock_address=https://gitlab.com/api/v4/projects/#{GITLAB_PROJECT_ID}/terraform/state/#{Octopus.Deployment.Tenant.Id}-#{Octopus.Environment.Name}/lock\" -backend-config=\"unlock_address=https://gitlab.com/api/v4/projects/#{GITLAB_PROJECT_ID}/terraform/state/#{Octopus.Deployment.Tenant.Id}-#{Octopus.Environment.Name}/lock\" -backend-config=\"username=developerdurp\" -backend-config=\"password=#{GITLAB_TOKEN}\" -backend-config=\"lock_method=POST\" -backend-config=\"unlock_method=DELETE\" -backend-config=\"retry_wait_min=5\"" {}
}

View File

@@ -1,5 +1,5 @@
terraform {
# backend "http" {}
backend "http" {}
required_providers {
proxmox = {
source = "TheGameProfi/proxmox"

View File

@@ -33,3 +33,39 @@ resource "proxmox_vm_qemu" "master" {
nameserver = var.dnsserver
sshkeys = var.sshkeys
}
resource "proxmox_vm_qemu" "node" {
count = var.node.count
ciuser = "administrator"
vmid = "${var.vlan}${var.node.ip[count.index]}"
name = "rke-n-${var.appname}${format("%02d", count.index + 1)}"
target_node = var.node.node[count.index]
clone = var.node.template
qemu_os = "other"
full_clone = true
agent = 1
cores = var.node.cores
sockets = 1
cpu = "host"
memory = var.node.memory
scsihw = "virtio-scsi-pci"
bootdisk = "scsi0"
boot = "c"
onboot = false
network {
model = "virtio"
bridge = var.bridge
tag = var.vlan
firewall = false
}
lifecycle {
ignore_changes = [
network,
]
}
#Cloud Init Settings
ipconfig0 = "ip=192.168.${var.vlan}.${var.node.ip[count.index]}/24,gw=192.168.${var.vlan}.1"
searchdomain = var.searchdomain
nameserver = var.dnsserver
sshkeys = var.sshkeys
}

View File

@@ -46,3 +46,14 @@ variable "master" {
})
}
variable "node" {
description = "Defaults of worker nodes in K3S"
type = object({
count = number
template = string
cores = number
memory = number
node = list(string)
ip = list(number)
})
}

View File

@@ -6,14 +6,22 @@ appname = "#{appname}"
searchdomain = "#{searchdomain}"
master = {
count = #{count}
template = "#{template}"
cores = #{cores}
memory = "#{memory}"
node = [#{node}]
ip = [#{ip}]
count = #{master-count}
template = "#{master-template}"
cores = #{master-cores}
memory = "#{master-memory}"
node = [#{master-node}]
ip = [#{master-ip}]
}
node = {
count = #{node-count}
template = "#{node-template}"
cores = #{node-cores}
memory = "#{node-memory}"
node = [#{node-node}]
ip = [#{node-ip}]
}
pm_api_url = "#{pm_api_url}"
pm_api_token_id = "#{pm_api_token_id}"
pm_api_token_secret = "#{pm_api_token_secret}"