new test vm for creation process.
This commit is contained in:
60
testvm.tf
Normal file
60
testvm.tf
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
variable "ip" {
|
||||||
|
description = "Ip address of vm"
|
||||||
|
type = string
|
||||||
|
default = "192.168.0.64" # Optional: A default value
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "hostname" {
|
||||||
|
description = "test2"
|
||||||
|
type = string
|
||||||
|
default = "t2.micro" # Optional: A default value
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "flask_token" {
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "proxmox_lxc" var.hostname {
|
||||||
|
target_node = "ryuk"
|
||||||
|
hostname = var.hostname
|
||||||
|
vmid = 217
|
||||||
|
ostemplate = "cephfs:vztmpl/debian-13-standard_13.1-2_amd64.tar.zst"
|
||||||
|
password = "terraform"
|
||||||
|
unprivileged = true
|
||||||
|
cores = 5
|
||||||
|
memory = 4096
|
||||||
|
swap = 1024
|
||||||
|
start = true
|
||||||
|
tags = "terraform;deb13"
|
||||||
|
nameserver = "192.168.0.224"
|
||||||
|
ssh_public_keys = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINFw70PrMsilcsqCrwW1I6PAt3anQbhmVg+t/HUfomug ryan@mxDesktop"
|
||||||
|
|
||||||
|
features {
|
||||||
|
nesting = true
|
||||||
|
}
|
||||||
|
|
||||||
|
rootfs {
|
||||||
|
storage = "local-lvm"
|
||||||
|
size = "32G"
|
||||||
|
}
|
||||||
|
|
||||||
|
mountpoint{
|
||||||
|
key = "0"
|
||||||
|
slot = 0
|
||||||
|
storage = "CephSSD"
|
||||||
|
mp = "/data"
|
||||||
|
size = "400G"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
network {
|
||||||
|
name = "eth0"
|
||||||
|
bridge = "vmbr0"
|
||||||
|
ip = "${var.ip}/24"
|
||||||
|
gw = "192.168.0.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
provisioner "local-exec" {
|
||||||
|
command = "curl -k -X POST https://192.168.0.143:5000/setupansible/${var.hostname}/${var.ip} -H \"Authorization: Bearer ${var.flask_token}\""
|
||||||
|
}
|
||||||
|
}
|
||||||
7
wikmd.tf
7
wikmd.tf
@@ -14,9 +14,9 @@ variable "flask_token" {
|
|||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "proxmox_lxc" "wikmd" {
|
resource "proxmox_lxc" var.hostname {
|
||||||
target_node = "ryuk"
|
target_node = "ryuk"
|
||||||
hostname = "wikmd"
|
hostname = var.hostname
|
||||||
vmid = 217
|
vmid = 217
|
||||||
ostemplate = "cephfs:vztmpl/debian-13-standard_13.1-2_amd64.tar.zst"
|
ostemplate = "cephfs:vztmpl/debian-13-standard_13.1-2_amd64.tar.zst"
|
||||||
password = "terraform"
|
password = "terraform"
|
||||||
@@ -25,7 +25,7 @@ resource "proxmox_lxc" "wikmd" {
|
|||||||
memory = 4096
|
memory = 4096
|
||||||
swap = 1024
|
swap = 1024
|
||||||
start = true
|
start = true
|
||||||
tags = "terraform;deb13;test"
|
tags = "terraform;deb13"
|
||||||
nameserver = "192.168.0.224"
|
nameserver = "192.168.0.224"
|
||||||
ssh_public_keys = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINFw70PrMsilcsqCrwW1I6PAt3anQbhmVg+t/HUfomug ryan@mxDesktop"
|
ssh_public_keys = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINFw70PrMsilcsqCrwW1I6PAt3anQbhmVg+t/HUfomug ryan@mxDesktop"
|
||||||
|
|
||||||
@@ -57,5 +57,4 @@ resource "proxmox_lxc" "wikmd" {
|
|||||||
provisioner "local-exec" {
|
provisioner "local-exec" {
|
||||||
command = "curl -k -X POST https://192.168.0.143:5000/setupansible/${var.hostname}/${var.ip} -H \"Authorization: Bearer ${var.flask_token}\""
|
command = "curl -k -X POST https://192.168.0.143:5000/setupansible/${var.hostname}/${var.ip} -H \"Authorization: Bearer ${var.flask_token}\""
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user