added new vm infra vm to homelab
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-10-27 13:23:35 +02:00
parent 85625c50e2
commit dc025e3c94
3 changed files with 101 additions and 4 deletions

View File

@@ -39,8 +39,8 @@ steps:
image: hashicorp/terraform:1.5 image: hashicorp/terraform:1.5
commands: commands:
- terraform -chdir=infrastructure validate - terraform -chdir=infrastructure validate
- terraform -chdir=infrastructure plan - terraform -chdir=infrastructure plan -out tfapply
- terraform -chdir=infrastructure apply - terraform -chdir=infrastructure apply -auto-approve tfapply
environment: environment:
TF_VAR_virtual_environment_endpoint: TF_VAR_virtual_environment_endpoint:
from_secret: virtual_environment_endpoint from_secret: virtual_environment_endpoint
@@ -82,8 +82,8 @@ steps:
image: hashicorp/terraform:1.5 image: hashicorp/terraform:1.5
commands: commands:
- terraform -chdir=infrastructure validate - terraform -chdir=infrastructure validate
- terraform -chdir=infrastructure plan - terraform -chdir=infrastructure plan -out tfapply
- terraform -chdir=infrastructure apply - terraform -chdir=infrastructure apply -auto-approve tfapply
environment: environment:
TF_VAR_virtual_environment_endpoint: TF_VAR_virtual_environment_endpoint:
from_secret: virtual_environment_endpoint from_secret: virtual_environment_endpoint

2
.gitignore vendored
View File

@@ -7,6 +7,8 @@
*.tfstate *.tfstate
*.tfstate.* *.tfstate.*
tfapply
# Crash log files # Crash log files
crash.log crash.log
crash.*.log crash.*.log

95
infrastructure/infra.tf Normal file
View File

@@ -0,0 +1,95 @@
# proxmox_virtual_environment_vm.devops:
resource "proxmox_virtual_environment_vm" "infra" {
acpi = true
vm_id = "113"
machine = "q35"
name = "infra"
node_name = "proxmox"
scsi_hardware = "virtio-scsi-pci"
started = true
tablet_device = false
tags = []
template = false
clone {
vm_id = 9999
}
agent {
enabled = true
timeout = "15m"
trim = false
type = "virtio"
}
cpu {
cores = 2
flags = []
hotplugged = 0
numa = false
sockets = 1
type = "host"
units = 1024
}
disk {
datastore_id = "local"
size = 30
ssd = true
iothread = true
interface = "scsi0"
}
initialization {
datastore_id = "local"
interface = "ide2"
ip_config {
ipv4 {
address = "dhcp"
}
ipv6 {
address = "auto"
}
}
user_account {
keys = var.virtual_environment_sshkeys
username = "tim"
password = random_password.devops_vm_password.result
}
}
memory {
dedicated = 4096
floating = 0
shared = 0
}
network_device {
bridge = "vmbr0"
enabled = true
firewall = false
model = "virtio"
mtu = 0
rate_limit = 0
vlan_id = 0
}
vga {
enabled = true
memory = 16
type = "std"
}
}
resource "random_password" "infra_vm_password" {
length = 16
override_special = "_%@"
special = true
}
output "infra_vm_password" {
value = random_password.devops_vm_password.result
sensitive = true
}