From 74bdaf49a5b05666d2199138a294bbc95e348c02 Mon Sep 17 00:00:00 2001 From: jerome Date: Tue, 25 Mar 2025 12:31:24 +0100 Subject: bastion SSH --- container/main.tf | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'container/main.tf') diff --git a/container/main.tf b/container/main.tf index f20d671..1f0933d 100644 --- a/container/main.tf +++ b/container/main.tf @@ -40,18 +40,26 @@ resource "proxmox_lxc" "stagiaire" { network { name = "eth0" bridge = "vmbr0" - ip = "192.168.2.${var.vmid}/24" - gw = "192.168.2.254" + ip = "192.168.10.${var.vmid}/24" + tag = "10" + gw = "192.168.10.1" } + nameserver = "8.8.8.8" features { nesting = true } + provisioner "local-exec" { + command = "./local_script 192.168.10.${var.vmid}" + } + provisioner "remote-exec" { connection { type = "ssh" - host = "192.168.2.${var.vmid}" + host = "192.168.10.${var.vmid}" + bastion_host = "pve.xlinfo.fr" + bastion_user = "stagiaire" user = "root" private_key = file("~/.ssh/id_rsa") timeout = "5m" @@ -60,9 +68,4 @@ resource "proxmox_lxc" "stagiaire" { "touch terraform_ok" ] } - - provisioner "local-exec" { - command = "./local_script 192.168.2.${var.vmid}" - } - } -- cgit v1.2.3