feat: Update workflows for Token-based Git clone
This commit is contained in:
+18
-9
@@ -17,25 +17,26 @@ provider "proxmox" {
|
||||
resource "proxmox_lxc" "staging" {
|
||||
target_node = var.proxmox_node
|
||||
hostname = "hugo-staging"
|
||||
vmid = 200
|
||||
ostemplate = var.lxc_ostemplate
|
||||
unprivileged = true
|
||||
start = true
|
||||
onboot = false
|
||||
|
||||
cores = 1
|
||||
memory = 512
|
||||
cores = 2
|
||||
memory = 1024
|
||||
swap = 512
|
||||
|
||||
rootfs {
|
||||
storage = var.lxc_storage
|
||||
size = "8G"
|
||||
size = "10G"
|
||||
}
|
||||
|
||||
network {
|
||||
name = "eth0"
|
||||
bridge = "vmbr0"
|
||||
ip = var.staging_ip
|
||||
gw = var.staging_gw != "" ? var.staging_gw : null
|
||||
bridge = var.lxc_bridge
|
||||
ip = "${var.staging_ip}/24"
|
||||
gw = var.staging_gw
|
||||
}
|
||||
|
||||
ssh_public_keys = var.ssh_public_key
|
||||
@@ -43,18 +44,26 @@ resource "proxmox_lxc" "staging" {
|
||||
provisioner "remote-exec" {
|
||||
inline = [
|
||||
"apt-get update -qq",
|
||||
"apt-get install -y nginx",
|
||||
"apt-get install -y hugo nginx git rsync curl",
|
||||
"systemctl enable --now nginx",
|
||||
"useradd -m -s /bin/bash deploy || true",
|
||||
"mkdir -p /home/deploy/.ssh",
|
||||
"chmod 700 /home/deploy/.ssh",
|
||||
"echo '${var.ssh_public_key}' >> /home/deploy/.ssh/authorized_keys",
|
||||
"chmod 600 /home/deploy/.ssh/authorized_keys",
|
||||
"chown -R deploy:deploy /home/deploy/.ssh",
|
||||
"mkdir -p /var/www/html",
|
||||
"chown -R www-data:www-data /var/www/html"
|
||||
"chown -R deploy:deploy /var/www/html"
|
||||
]
|
||||
connection {
|
||||
type = "ssh"
|
||||
user = "root"
|
||||
private_key = file("~/.ssh/deploy_key")
|
||||
private_key = var.ssh_private_key
|
||||
host = self.network[0].ip
|
||||
}
|
||||
}
|
||||
|
||||
depends_on = []
|
||||
}
|
||||
|
||||
output "staging_ip" {
|
||||
|
||||
+15
-5
@@ -17,7 +17,11 @@ variable "proxmox_token_secret" {
|
||||
variable "proxmox_node" {
|
||||
description = "Ziel-Proxmox-Node"
|
||||
type = string
|
||||
default = "pve"
|
||||
}
|
||||
|
||||
variable "lxc_bridge" {
|
||||
description = "Netzwerk-Bridge (z.B. vmbr2)"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "lxc_ostemplate" {
|
||||
@@ -33,18 +37,24 @@ variable "lxc_storage" {
|
||||
}
|
||||
|
||||
variable "staging_ip" {
|
||||
description = "Statische IP fuer Staging-LXC (CIDR)"
|
||||
description = "Statische IP fuer Staging-LXC (ohne CIDR)"
|
||||
type = string
|
||||
default = "dhcp"
|
||||
default = "172.17.1.100"
|
||||
}
|
||||
|
||||
variable "staging_gw" {
|
||||
description = "Gateway fuer Staging-LXC"
|
||||
type = string
|
||||
default = ""
|
||||
default = "172.17.1.1"
|
||||
}
|
||||
|
||||
variable "ssh_public_key" {
|
||||
description = "SSH Public Key fuer den deploy-User im LXC"
|
||||
description = "SSH Public Key fuer deploy-User im LXC"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "ssh_private_key" {
|
||||
description = "SSH Private Key (für Provisioning)"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user