Merge pull request 'stage' (#11) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 5m57s
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 5m57s
Reviewed-on: #11
This commit is contained in:
commit
3e55a72767
@ -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
|
||||
|
@ -4,7 +4,6 @@ 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
|
||||
@ -18,20 +17,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" {
|
||||
@ -39,7 +38,6 @@ 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
|
||||
@ -53,18 +51,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"
|
||||
# }
|
||||
#}
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
9
terraform/files/cloud_init_base.yaml
Normal file
9
terraform/files/cloud_init_base.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
#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
|
||||
|
@ -30,7 +30,6 @@ resource "proxmox_vm_qemu" "alpacas" {
|
||||
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"
|
||||
@ -63,7 +62,6 @@ resource "proxmox_vm_qemu" "llamas" {
|
||||
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"
|
||||
|
@ -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": {},
|
||||
|
@ -79,9 +79,3 @@ 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"
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user