Add terraform for infra
This commit is contained in:
@@ -26,9 +26,9 @@ locals {
|
|||||||
dnsserver = "192.168.12.1"
|
dnsserver = "192.168.12.1"
|
||||||
tags = "postgres"
|
tags = "postgres"
|
||||||
vlan = 12
|
vlan = 12
|
||||||
postgres = {
|
haproxy = {
|
||||||
count = 3
|
count = 3
|
||||||
name = ["postgres-01", "postgres-02", "postgres-03"]
|
name = ["haproxy-01", "haproxy-02", "haproxy-03"]
|
||||||
cores = 2
|
cores = 2
|
||||||
memory = "1024"
|
memory = "1024"
|
||||||
drive = 20
|
drive = 20
|
||||||
@@ -46,22 +46,22 @@ locals {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "proxmox_vm_qemu" "postgres" {
|
resource "proxmox_vm_qemu" "haproxy" {
|
||||||
count = local.postgres.count
|
count = local.haproxy.count
|
||||||
ciuser = "administrator"
|
ciuser = "administrator"
|
||||||
vmid = "${local.vlan}${local.postgres.ip[count.index]}"
|
vmid = "${local.vlan}${local.haproxy.ip[count.index]}"
|
||||||
name = local.postgres.name[count.index]
|
name = local.haproxy.name[count.index]
|
||||||
target_node = local.postgres.node[count.index]
|
target_node = local.haproxy.node[count.index]
|
||||||
clone = local.template
|
clone = local.template
|
||||||
tags = local.tags
|
tags = local.tags
|
||||||
qemu_os = "l26"
|
qemu_os = "l26"
|
||||||
full_clone = true
|
full_clone = true
|
||||||
os_type = "cloud-init"
|
os_type = "cloud-init"
|
||||||
agent = 1
|
agent = 1
|
||||||
cores = local.postgres.cores
|
cores = local.haproxy.cores
|
||||||
sockets = 1
|
sockets = 1
|
||||||
cpu_type = "host"
|
cpu_type = "host"
|
||||||
memory = local.postgres.memory
|
memory = local.haproxy.memory
|
||||||
scsihw = "virtio-scsi-pci"
|
scsihw = "virtio-scsi-pci"
|
||||||
#bootdisk = "scsi0"
|
#bootdisk = "scsi0"
|
||||||
boot = "order=virtio0"
|
boot = "order=virtio0"
|
||||||
@@ -78,7 +78,7 @@ resource "proxmox_vm_qemu" "postgres" {
|
|||||||
virtio {
|
virtio {
|
||||||
virtio0 {
|
virtio0 {
|
||||||
disk {
|
disk {
|
||||||
size = local.postgres.drive
|
size = local.haproxy.drive
|
||||||
format = local.format
|
format = local.format
|
||||||
storage = local.storage
|
storage = local.storage
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ resource "proxmox_vm_qemu" "postgres" {
|
|||||||
tag = local.vlan
|
tag = local.vlan
|
||||||
}
|
}
|
||||||
#Cloud Init Settings
|
#Cloud Init Settings
|
||||||
ipconfig0 = "ip=192.168.${local.vlan}.${local.postgres.ip[count.index]}/24,gw=192.168.${local.vlan}.1"
|
ipconfig0 = "ip=192.168.${local.vlan}.${local.haproxy.ip[count.index]}/24,gw=192.168.${local.vlan}.1"
|
||||||
searchdomain = "durp.loc"
|
searchdomain = "durp.loc"
|
||||||
nameserver = local.dnsserver
|
nameserver = local.dnsserver
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user