diff options
| -rw-r--r-- | container/main.tf | 19 | ||||
| -rwxr-xr-x | local_script | 4 |
2 files changed, 13 insertions, 10 deletions
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}" - } - } diff --git a/local_script b/local_script index 3994e4f..e48ed99 100755 --- a/local_script +++ b/local_script @@ -1,3 +1,3 @@ #!/bin/bash -ssh-keygen -f ~/.ssh/known_hosts -R $1 -ssh-keyscan -H $1 >> ~/.ssh/known_hosts +ssh-keygen -f ~/.ssh/known_hosts -R $1 || true +ssh-keyscan -H $1 >> ~/.ssh/known_hosts || true |
