Compare commits

34 Commits

Author SHA1 Message Date
8d9eea6728 Merge pull request 'terraform fmt' (#16) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 1m42s
Reviewed-on: #16
2025-04-17 21:54:27 +00:00
MichaelFisher1997
96f6d94c3a terraform fmt
All checks were successful
Gitea Actions Demo / Terraform Plan (push) Successful in 26s
2025-04-17 22:50:43 +01:00
8d49e447e6 Merge pull request 'terraform fmt' (#15) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 1m39s
Reviewed-on: #15
2025-04-17 21:40:34 +00:00
MichaelFisher1997
99f3610a84 terraform fmt
All checks were successful
Gitea Actions Demo / Terraform Plan (push) Successful in 40s
2025-04-17 22:38:09 +01:00
d634e124a3 Merge pull request 'stage' (#14) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 1m11s
Reviewed-on: #14
2025-04-17 21:29:51 +00:00
MichaelFisher1997
70b9b5e5b7 terraform fmt
All checks were successful
Gitea Actions Demo / Terraform Plan (push) Successful in 40s
2025-04-17 22:28:45 +01:00
MichaelFisher1997
93d3f94100 terraform fmt
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Failing after 22s
2025-04-17 22:24:54 +01:00
70139b2693 Merge pull request 'terraform fmt' (#13) from stage into master
Some checks failed
Gitea Actions Demo / Terraform Apply (push) Failing after 30s
Reviewed-on: #13
2025-04-17 21:18:18 +00:00
MichaelFisher1997
8773f5026c terraform fmt
All checks were successful
Gitea Actions Demo / Terraform Plan (push) Successful in 45s
2025-04-17 22:15:22 +01:00
1b6eca0f69 Merge pull request 'stage' (#12) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 4m29s
Reviewed-on: #12
2025-04-17 21:00:27 +00:00
MichaelFisher1997
9551e0ad53 terraform fmt
All checks were successful
Gitea Actions Demo / Terraform Plan (push) Successful in 23s
2025-04-17 21:59:31 +01:00
MichaelFisher1997
ffc1c1e785 terraform fmt
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Failing after 20s
2025-04-17 21:58:07 +01:00
3e55a72767 Merge pull request 'stage' (#11) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 5m57s
Reviewed-on: #11
2025-04-17 20:27:27 +00:00
MichaelFisher1997
fcbd6a0b1d terraform fmt
All checks were successful
Gitea Actions Demo / Terraform Plan (push) Successful in 55s
2025-04-17 20:39:32 +01:00
MichaelFisher1997
7227782d4f terraform fmt
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Has been cancelled
2025-04-17 20:38:13 +01:00
MichaelFisher1997
6dec58856e terraform fmt
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Failing after 21s
2025-04-17 20:36:10 +01:00
MichaelFisher1997
437d7ab8d1 terraform fmt
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Failing after 35s
2025-04-17 20:24:03 +01:00
MichaelFisher1997
ac2db5a1cf terraform fmt
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Failing after 31s
2025-04-17 20:21:16 +01:00
MichaelFisher1997
74b2fb8175 terraform fmt
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Failing after 53s
2025-04-17 20:17:29 +01:00
MichaelFisher1997
1acd33cb87 terraform fmt
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Failing after 1m7s
2025-04-17 20:12:37 +01:00
MichaelFisher1997
f9edeb8be5 terraform fmt
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Has been cancelled
2025-04-17 20:07:17 +01:00
MichaelFisher1997
661fb95830 terraform fmt
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Failing after 28s
2025-04-17 20:05:13 +01:00
MichaelFisher1997
50ae59602c terraform fmt
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Failing after 25s
2025-04-17 20:03:28 +01:00
MichaelFisher1997
507c102dad terraform fmt
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Failing after 31s
2025-04-17 20:01:52 +01:00
b26ff582a4 Merge pull request 'terraform fmt' (#10) from stage into master
Some checks failed
Gitea Actions Demo / Terraform Apply (push) Failing after 5m42s
Reviewed-on: #10
2025-04-17 18:24:08 +00:00
MichaelFisher1997
ec07db08db terraform fmt
All checks were successful
Gitea Actions Demo / Terraform Plan (push) Successful in 55s
2025-04-17 19:21:23 +01:00
114bfb9772 Merge pull request 'stage' (#8) from stage into master
Some checks failed
Gitea Actions Demo / Terraform Apply (push) Failing after 5m24s
Reviewed-on: #8
2025-04-17 16:12:34 +00:00
5509e14066 Merge pull request 'stage' (#7) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 4m26s
Reviewed-on: #7
2025-04-17 15:15:02 +00:00
df088a7903 Merge pull request 'terraform apply' (#6) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 4m38s
Reviewed-on: #6
2025-04-17 14:06:19 +00:00
dcec6c3648 Merge pull request 'stage' (#5) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 4m24s
Reviewed-on: #5
2025-04-17 12:46:36 +00:00
a0ee1b8a4b Merge pull request 'terraform apply' (#4) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 1m51s
Reviewed-on: #4
2025-04-17 12:19:34 +00:00
39d4e2ac65 Merge pull request 'terraform apply' (#3) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 4m52s
Reviewed-on: #3
2025-04-17 10:22:41 +00:00
6d06cfac02 Merge pull request 'terraform apply' (#2) from stage into master
Some checks failed
Gitea Actions Demo / Terraform Apply (push) Failing after 2m55s
Reviewed-on: #2
2025-04-17 10:11:32 +00:00
e669353638 Merge pull request 'terraform apply' (#1) from stage into master
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Successful in 37s
Gitea Actions Demo / Terraform Apply (push) Has been cancelled
Reviewed-on: #1
2025-04-17 10:04:50 +00:00
10 changed files with 86 additions and 103 deletions

View File

@@ -16,6 +16,7 @@ jobs:
pull-requests: write
env:
TF_VAR_SSH_KEY: ${{ secrets.SSH_KEY }}
TF_VAR_TS_AUTHKEY: ${{ secrets.TAILSCALE_KEY }}
TF_VAR_ssh_key: ${{ secrets.SSH_PUBLIC_KEY }}

View File

@@ -14,8 +14,10 @@ jobs:
pull-requests: write
env:
TF_VAR_TS_AUTHKEY: ${{ secrets.TAILSCALE_KEY }}
TF_VAR_ssh_key: ${{ secrets.SSH_PUBLIC_KEY }}
TF_VAR_SSH_KEY: ${{ secrets.SSH_KEY }}
TF_VAR_TS_AUTHKEY: ${{ secrets.TAILSCALE_KEY }}
TF_VAR_ssh_key: ${{ secrets.SSH_PUBLIC_KEY }}
steps:
- name: Checkout repository

View File

@@ -17,10 +17,9 @@ jobs:
pull-requests: write
env:
TF_VAR_TAILSCALE_KEY: ${{ secrets.TAILSCALE_KEY }}
TF_VAR_SSH_KEY: ${{ secrets.SSH_KEY }}
TF_VAR_TS_AUTHKEY: ${{ secrets.TAILSCALE_KEY }}
TF_VAR_ssh_key: ${{ secrets.SSH_PUBLIC_KEY }}
# TF_VAR_ssh_key: ${{ secrets.SSH_PUBLIC_KEY }}
steps:
- name: Checkout repository

View File

@@ -1,70 +1,17 @@
### Alpaca cloud-init template
data "template_file" "cloud_init_alpaca" {
count = var.alpaca_vm_count
template = file("${path.module}/files/cloud_init.yaml")
### Global cloud-init template (for all VMs)
data "template_file" "cloud_init_global" {
template = file("${path.module}/files/cloud_init_global.yaml")
vars = {
ssh_key = var.ssh_key
hostname = "alpaca-${count.index + 1}"
hostname = "generic"
domain = "home.arpa"
TS_AUTHKEY = var.TS_AUTHKEY
}
}
resource "local_file" "cloud_init_alpaca" {
count = var.alpaca_vm_count
content = data.template_file.cloud_init_alpaca[count.index].rendered
filename = "${path.module}/files/cloud_init_alpaca_${count.index + 1}.yaml"
}
resource "null_resource" "upload_cloud_init_alpaca" {
count = var.alpaca_vm_count
connection {
type = "ssh"
user = "root"
host = var.target_node
}
provisioner "file" {
source = local_file.cloud_init_alpaca[count.index].filename
destination = "/var/lib/vz/snippets/cloud_init_alpaca_${count.index + 1}.yaml"
}
}
### Llama cloud-init template
data "template_file" "cloud_init_llama" {
count = var.llama_vm_count
template = file("${path.module}/files/cloud_init.yaml")
vars = {
ssh_key = var.ssh_key
hostname = "llama-${count.index + 1}"
domain = "home.arpa"
TS_AUTHKEY = var.TS_AUTHKEY
}
}
resource "local_file" "cloud_init_llama" {
count = var.llama_vm_count
content = data.template_file.cloud_init_llama[count.index].rendered
filename = "${path.module}/files/cloud_init_llama_${count.index + 1}.yaml"
}
resource "null_resource" "upload_cloud_init_llama" {
count = var.llama_vm_count
connection {
type = "ssh"
user = "root"
host = var.target_node
}
provisioner "file" {
source = local_file.cloud_init_llama[count.index].filename
destination = "/var/lib/vz/snippets/cloud_init_llama_${count.index + 1}.yaml"
}
resource "local_file" "cloud_init_global" {
content = data.template_file.cloud_init_global.rendered
filename = "${path.module}/files/cloud_init_global.yaml"
}

View File

@@ -1,10 +1,9 @@
#cloud-config
hostname: ${hostname}
fqdn: ${hostname}.${domain}
ssh_authorized_keys:
- ${ssh_key}
runcmd:
- curl -fsSL https://tailscale.com/install.sh | sh
- tailscale up --auth-key=${TS_AUTHKEY}
- tailscale set --ssh

View File

@@ -0,0 +1,6 @@
#cloud-config
runcmd:
- curl -fsSL https://tailscale.com/install.sh | sh
- tailscale up --auth-key=${TS_AUTHKEY}
- tailscale set --ssh

View File

@@ -0,0 +1,18 @@
#cloud-config
hostname: ${hostname}
fqdn: ${hostname}.${domain}
#cloud-config
# The above header must generally appear on the first line of a cloud config
# file, but all other lines that begin with a # are optional comments.
runcmd:
# One-command install, from https://tailscale.com/download/
- ['sh', '-c', 'curl -fsSL https://tailscale.com/install.sh | sh']
# Set sysctl settings for IP forwarding (useful when configuring an exit node)
- ['sh', '-c', "echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf && echo 'net.ipv6.conf.all.forwarding = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf && sudo sysctl -p /etc/sysctl.d/99-tailscale.conf" ]
# Generate an auth key from your Admin console
# https://login.tailscale.com/admin/settings/keys
# and replace the placeholder below
- ['tailscale', 'up', '--auth-key=${TS_AUTHKEY}']

View File

@@ -20,23 +20,32 @@ resource "proxmox_vm_qemu" "alpacas" {
vmid = 500 + count.index + 1
target_node = var.target_node
clone = var.clone_template
full_clone = false
full_clone = true
agent = 1
sockets = var.sockets
cores = var.cores
memory = var.memory
scsihw = "virtio-scsi-pci"
boot = "order=scsi0"
ipconfig0 = "ip=dhcp"
cicustom = "user=local:snippets/cloud_init_alpaca_${count.index + 1}.yaml"
depends_on = [null_resource.upload_cloud_init_alpaca]
sockets = var.sockets
cores = var.cores
memory = var.memory
scsihw = "virtio-scsi-pci"
boot = "order=scsi0"
ipconfig0 = "ip=dhcp"
cicustom = "user=local:snippets/cloud_init_global.yaml"
disk {
slot = "scsi0"
type = "disk"
storage = var.storage
size = var.disk_size
disks {
scsi {
scsi0 {
disk {
size = var.disk_size
storage = var.storage
}
}
scsi1 {
cloudinit {
storage = var.storage
}
}
}
}
network {
@@ -53,23 +62,31 @@ resource "proxmox_vm_qemu" "llamas" {
vmid = 600 + count.index + 1
target_node = var.target_node
clone = var.clone_template
full_clone = false
full_clone = true
agent = 1
sockets = var.sockets
cores = var.cores
memory = var.memory
scsihw = "virtio-scsi-pci"
boot = "order=scsi0"
ipconfig0 = "ip=dhcp"
cicustom = "user=local:snippets/cloud_init_llama_${count.index + 1}.yaml"
depends_on = [null_resource.upload_cloud_init_llama]
sockets = var.sockets
cores = var.cores
memory = var.memory
scsihw = "virtio-scsi-pci"
boot = "order=scsi0"
ipconfig0 = "ip=dhcp"
cicustom = "user=local:snippets/cloud_init_global.yaml"
disk {
slot = "scsi0"
type = "disk"
storage = var.storage
size = var.disk_size
disks {
scsi {
scsi0 {
disk {
size = var.disk_size
storage = var.storage
}
}
scsi1 {
cloudinit {
storage = var.storage
}
}
}
}
network {

View File

@@ -1,6 +1,6 @@
{
"version": 4,
"terraform_version": "1.11.4",
"terraform_version": "1.8.3",
"serial": 31,
"lineage": "7a39dd41-1655-172c-950b-b8c5398caf69",
"outputs": {},

View File

@@ -79,9 +79,3 @@ variable "TS_AUTHKEY" {
description = "Tailscale auth key used in cloud-init"
}
variable "ssh_key" {
type = string
description = "Public SSH key used by cloud-init"
}