This commit is contained in:
@@ -32,7 +32,8 @@ jobs:
|
|||||||
-var="staging_ip=${{ secrets.STAGING_IP }}" \
|
-var="staging_ip=${{ secrets.STAGING_IP }}" \
|
||||||
-var="staging_gw=${{ secrets.STAGING_GW }}" \
|
-var="staging_gw=${{ secrets.STAGING_GW }}" \
|
||||||
-var="ssh_public_key=${{ secrets.DEPLOY_SSH_PUBKEY }}" \
|
-var="ssh_public_key=${{ secrets.DEPLOY_SSH_PUBKEY }}" \
|
||||||
-var="ssh_private_key=${{ secrets.DEPLOY_SSH_KEY }}"
|
-var="ssh_private_key=${{ secrets.DEPLOY_SSH_KEY }}" \
|
||||||
|
-var="root_password=${{ secrets.ROOT_PASSWORD }}"
|
||||||
env:
|
env:
|
||||||
TF_IN_AUTOMATION: "true"
|
TF_IN_AUTOMATION: "true"
|
||||||
|
|
||||||
|
|||||||
@@ -48,15 +48,23 @@ resource "proxmox_lxc" "staging" {
|
|||||||
|
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
inline = [
|
inline = [
|
||||||
|
# Root Password setzen
|
||||||
|
"echo 'root:${var.root_password}' | chpasswd",
|
||||||
|
|
||||||
|
# System Setup
|
||||||
"apt-get update -qq",
|
"apt-get update -qq",
|
||||||
"apt-get install -y hugo nginx git rsync curl",
|
"apt-get install -y hugo nginx git rsync curl",
|
||||||
"systemctl enable --now nginx",
|
"systemctl enable --now nginx",
|
||||||
|
|
||||||
|
# Deploy User mit SSH Key
|
||||||
"useradd -m -s /bin/bash deploy || true",
|
"useradd -m -s /bin/bash deploy || true",
|
||||||
"mkdir -p /home/deploy/.ssh",
|
"mkdir -p /home/deploy/.ssh",
|
||||||
"chmod 700 /home/deploy/.ssh",
|
"chmod 700 /home/deploy/.ssh",
|
||||||
"echo '${var.ssh_public_key}' >> /home/deploy/.ssh/authorized_keys",
|
"echo '${var.ssh_public_key}' >> /home/deploy/.ssh/authorized_keys",
|
||||||
"chmod 600 /home/deploy/.ssh/authorized_keys",
|
"chmod 600 /home/deploy/.ssh/authorized_keys",
|
||||||
"chown -R deploy:deploy /home/deploy/.ssh",
|
"chown -R deploy:deploy /home/deploy/.ssh",
|
||||||
|
|
||||||
|
# Web Root
|
||||||
"mkdir -p /var/www/html",
|
"mkdir -p /var/www/html",
|
||||||
"chown -R deploy:deploy /var/www/html"
|
"chown -R deploy:deploy /var/www/html"
|
||||||
]
|
]
|
||||||
@@ -65,6 +73,8 @@ resource "proxmox_lxc" "staging" {
|
|||||||
user = "root"
|
user = "root"
|
||||||
private_key = var.ssh_private_key
|
private_key = var.ssh_private_key
|
||||||
host = self.network[0].ip
|
host = self.network[0].ip
|
||||||
|
timeout = "10m"
|
||||||
|
agent = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,3 +58,9 @@ variable "ssh_private_key" {
|
|||||||
type = string
|
type = string
|
||||||
sensitive = true
|
sensitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "root_password" {
|
||||||
|
description = "Root Password für Staging VM"
|
||||||
|
type = string
|
||||||
|
sensitive = true
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user