Compare commits

..

No commits in common. "3e55a7276736991b2f378fa497f6e65bf9ee5766" and "b26ff582a4ce62de09d2eb3066b5054d7e6f31ef" have entirely different histories.

7 changed files with 56 additions and 54 deletions

View File

@ -19,7 +19,7 @@ jobs:
env:
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

@ -4,6 +4,7 @@ data "template_file" "cloud_init_alpaca" {
template = file("${path.module}/files/cloud_init.yaml")
vars = {
ssh_key = var.SSH_KEY
hostname = "alpaca-${count.index + 1}"
domain = "home.arpa"
TS_AUTHKEY = var.TS_AUTHKEY
@ -17,20 +18,20 @@ resource "local_file" "cloud_init_alpaca" {
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"
# }
#}
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" {
@ -38,6 +39,7 @@ data "template_file" "cloud_init_llama" {
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
@ -51,18 +53,18 @@ resource "local_file" "cloud_init_llama" {
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 "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"
}
}

View File

@ -1,9 +1,10 @@
#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

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

View File

@ -23,13 +23,14 @@ resource "proxmox_vm_qemu" "alpacas" {
full_clone = false
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"
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]
disk {
slot = "scsi0"
@ -55,13 +56,14 @@ resource "proxmox_vm_qemu" "llamas" {
full_clone = false
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"
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]
disk {
slot = "scsi0"

View File

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

View File

@ -79,3 +79,9 @@ variable "TS_AUTHKEY" {
description = "Tailscale auth key used in cloud-init"
}
variable "SSH_KEY" {
type = string
description = "Private SSH key used to upload cloud-init files to Proxmox"
}