save DHCP leases on data disk

closes #4
This commit is contained in:
Pim Kunis 2023-04-17 09:18:59 +02:00
parent 5ed9205db4
commit 90b1aaff2f
3 changed files with 33 additions and 0 deletions

View file

@ -44,3 +44,5 @@ address=/ns.pizzapim.nl/ns.geokunis2.nl/ns.pim.kunis.nl/192.168.30.7
address=/ns.pizzapim.nl/ns.geokunis2.nl/ns.pim.kunis.nl/2a02:58:19a:f730:c8fe:c0ff:feff:ee07 address=/ns.pizzapim.nl/ns.geokunis2.nl/ns.pim.kunis.nl/2a02:58:19a:f730:c8fe:c0ff:feff:ee07
# Advertise DNS server # Advertise DNS server
dhcp-option=option:dns-server,192.168.30.1 dhcp-option=option:dns-server,192.168.30.1
# Change DHCP leases file
dhcp-leasefile=/mnt/data/dnsmasq.leases

30
terraform/data/main.tf Normal file
View file

@ -0,0 +1,30 @@
terraform {
backend "pg" {
schema_name = "hermes-data"
conn_str = "postgres://terraform@10.42.0.1/terraform_state"
}
required_providers {
libvirt = {
source = "dmacvicar/libvirt"
}
}
}
provider "libvirt" {
uri = "qemu+ssh://root@atlas.lan/system"
}
resource "libvirt_volume" "data" {
name = "hermes-data"
pool = "data"
size = 1024 * 1024
lifecycle {
prevent_destroy = true
}
}
output "data_disk_id" {
value = libvirt_volume.data.id
}

View file

@ -22,6 +22,7 @@ module "vm" {
source = "git::https://git.pim.kunis.nl/home/tf-modules.git//debian" source = "git::https://git.pim.kunis.nl/home/tf-modules.git//debian"
name = "hermes" name = "hermes"
domain_name = "tf-hermes" domain_name = "tf-hermes"
data_disk = "/kvm/data/hermes-data"
use_host_cert = false use_host_cert = false
fixed_address = "192.168.30.7/24" fixed_address = "192.168.30.7/24"
mac = "CA:FE:C0:FF:EE:07" mac = "CA:FE:C0:FF:EE:07"