changed structure and added drone ci

This commit is contained in:
2023-10-27 11:01:13 +02:00
parent d12d8f1e4d
commit 0ed46a355e
25 changed files with 239 additions and 1994 deletions

43
infrastructure/.terraform.lock.hcl generated Normal file
View File

@@ -0,0 +1,43 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/bpg/proxmox" {
version = "0.33.0"
constraints = "0.33.0"
hashes = [
"h1:nUwWvB9EkKTKLYHE2kGp1QhA/G6PShelx4sa8Aj2axg=",
"zh:0739b71b89f5ee4f85914fa56a6b19cc04ba742280d955774896631c7a86ad52",
"zh:12dddbf3f8f32b39ed157810870048642f8d31a819f53c60b1c53ac1f5fe5bef",
"zh:2254bcb5f2c9514ee85abec0ef5faa4123435a7c1359a4677a579c15f1eb145a",
"zh:25851121d6565c2bcbb9c32dd23dc7bc86fbf7030c139870d6f31c289db868ca",
"zh:368bc08c50fadf09cc8b536b6c4e67623dccfb1f3bc6747a7a0390ad04f1aa2b",
"zh:3a8f61636540b6620649125147a190561aad0c03c35a2cb7c7d282d062d00e91",
"zh:5d6c4128b4c3960309316c7de820506c8fdaea12dbc45b2932f2877e7b874c74",
"zh:60d72881e78a2d08efb049c41584e9fda25f2c7e56ce7794cb9d71d3fab3935a",
"zh:b00e0b4a867ab1e5a965f0d9b5fda9017846dc5fd899b55bc9c6c2f760570be9",
"zh:c20fdda3fe5d3ccff7486dd7112376a50a74e33369e9b6c4e303ec55dc896dc6",
"zh:d05b8924e745d12a353f91f182610d8b9e9f6c5a2789b0d89bd12ad765b10520",
"zh:d4d001c5b9ab675df94517755528d848dbf7bb6c140e0b02347d2a3fde3b45f3",
"zh:e2d13358d6a9dac597c5f12c7ee9f3203622a94cfe7b23a7b6ef0632630fd680",
"zh:ef3e57a977a5908e89b4ea484f0ac0cad59dc4490751f135c10c3c2ab966e9ee",
]
}
provider "registry.terraform.io/hashicorp/random" {
version = "3.5.1"
hashes = [
"h1:IL9mSatmwov+e0+++YX2V6uel+dV6bn+fC/cnGDK3Ck=",
"zh:04e3fbd610cb52c1017d282531364b9c53ef72b6bc533acb2a90671957324a64",
"zh:119197103301ebaf7efb91df8f0b6e0dd31e6ff943d231af35ee1831c599188d",
"zh:4d2b219d09abf3b1bb4df93d399ed156cadd61f44ad3baf5cf2954df2fba0831",
"zh:6130bdde527587bbe2dcaa7150363e96dbc5250ea20154176d82bc69df5d4ce3",
"zh:6cc326cd4000f724d3086ee05587e7710f032f94fc9af35e96a386a1c6f2214f",
"zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3",
"zh:b6d88e1d28cf2dfa24e9fdcc3efc77adcdc1c3c3b5c7ce503a423efbdd6de57b",
"zh:ba74c592622ecbcef9dc2a4d81ed321c4e44cddf7da799faa324da9bf52a22b2",
"zh:c7c5cde98fe4ef1143bd1b3ec5dc04baf0d4cc3ca2c5c7d40d17c0e9b2076865",
"zh:dac4bad52c940cd0dfc27893507c1e92393846b024c5a9db159a93c534a3da03",
"zh:de8febe2a2acd9ac454b844a4106ed295ae9520ef54dc8ed2faf29f12716b602",
"zh:eab0d0495e7e711cca367f7d4df6e322e6c562fc52151ec931176115b83ed014",
]
}

94
infrastructure/devops.tf Normal file
View File

@@ -0,0 +1,94 @@
# proxmox_virtual_environment_vm.devops:
resource "proxmox_virtual_environment_vm" "devops" {
acpi = true
vm_id = "112"
machine = "q35"
name = "devops"
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
interface = "virtio0"
}
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" "devops_vm_password" {
length = 16
override_special = "_%@"
special = true
}
output "devops_vm_password" {
value = random_password.devops_vm_password.result
sensitive = true
}

32
infrastructure/main.tf Normal file
View File

@@ -0,0 +1,32 @@
terraform {
required_providers {
proxmox = {
source = "bpg/proxmox"
version = "0.33"
}
}
backend "s3" {
bucket = "terraform-remote-state"
key = "terraform.tfstate"
endpoint = "http://10.20.1.5:9000"
access_key = "GeOhlbqGrL9KS1fZW06C"
secret_key = "PxWWN2KuK7m0GLLfH45sDTB0e4DhrSseL4KfmR8m"
region = "main"
skip_credentials_validation = true
skip_metadata_api_check = true
skip_region_validation = true
force_path_style = true
}
}
provider "proxmox" {
endpoint = var.virtual_environment_endpoint
api_token = var.virtual_environment_api_token
insecure = true
ssh {
agent = true
}
}

View File

@@ -0,0 +1,83 @@
resource "proxmox_virtual_environment_vm" "nextcloud_aio" {
acpi = true
bios = "ovmf"
vm_id = 111
node_name = "proxmox"
scsi_hardware = "virtio-scsi-single"
name = "nextcloud-aio"
started = true
tablet_device = true
tags = []
template = false
agent {
enabled = true
timeout = "15m"
trim = false
}
cpu {
architecture = "x86_64"
cores = 4
flags = []
hotplugged = 0
numa = false
sockets = 1
type = "x86-64-v2-AES"
units = 1024
}
efi_disk {
datastore_id = "local"
file_format = "qcow2"
pre_enrolled_keys = true
type = "4m"
}
initialization {
datastore_id = "local"
interface = "ide0"
ip_config {
ipv4 {
address = "10.20.1.8/16"
gateway = "10.20.0.1"
}
ipv6 {
address = "auto"
}
}
user_account {
keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHRYu07KxH1k+RvQ0JjDeLslwEgmWNdU5xtgYXCHoG7L tim@matabi",
]
username = "tim"
}
}
memory {
dedicated = 8192
floating = 0
shared = 0
}
network_device {
bridge = "vmbr0"
enabled = true
firewall = true
mac_address = "7A:D1:F3:47:8D:1B"
model = "virtio"
mtu = 0
rate_limit = 0
vlan_id = 0
}
operating_system {
type = "l26"
}
vga {
enabled = true
}
}

View File

@@ -0,0 +1,5 @@
resource "random_password" "vm_password" {
length = 16
override_special = "_%@"
special = true
}

View File

@@ -0,0 +1,69 @@
resource "proxmox_virtual_environment_container" "unifi" {
node_name = "proxmox"
started = true
tags = []
template = false
vm_id = 103
console {
enabled = true
tty_count = 2
type = "tty"
}
cpu {
architecture = "amd64"
cores = 2
units = 1024
}
disk {
datastore_id = "local"
size = 32
}
initialization {
hostname = "unifi"
ip_config {
ipv4 {
address = "10.20.1.2/16"
gateway = "10.20.0.1"
}
ipv6 {
address = "auto"
}
}
}
memory {
dedicated = 2048
swap = 512
}
network_interface {
bridge = "vmbr0"
enabled = true
firewall = true
mac_address = "CA:B6:50:D7:1E:C2"
mtu = 0
name = "eth0"
rate_limit = 0
vlan_id = 0
}
operating_system {
template_file_id = proxmox_virtual_environment_file.ubuntu_container_template.id
type = "ubuntu"
}
}
resource "proxmox_virtual_environment_file" "ubuntu_container_template" {
content_type = "vztmpl"
datastore_id = "local"
node_name = "proxmox"
source_file {
path = "http://download.proxmox.com/images/system/ubuntu-22.04-standard_22.04-1_amd64.tar.zst"
}
}

View File

@@ -0,0 +1,12 @@
variable "virtual_environment_endpoint" {
type = string
}
variable "virtual_environment_api_token" {
type = string
sensitive = true
}
variable "virtual_environment_sshkeys" {
type = list(any)
}

View File