add option for fixed DNS server

This commit is contained in:
Pim Kunis 2023-04-17 09:31:30 +02:00
parent 7234433575
commit c5cf385c86
3 changed files with 12 additions and 0 deletions

View file

@ -49,3 +49,9 @@ fs_setup:
mounts: mounts:
- ["data.1", "/mnt/data"] - ["data.1", "/mnt/data"]
%{ endif } %{ endif }
%{ if fixed_dns != "" }
manage_resolv_conf: true
resolv_conf:
nameservers:
- "${fixed_dns}"
%{ endif }

View file

@ -15,6 +15,7 @@ locals {
host_cert = trimspace(null_resource.cert.triggers["cert"]), host_cert = trimspace(null_resource.cert.triggers["cert"]),
private_key = tls_private_key.debian.private_key_openssh, private_key = tls_private_key.debian.private_key_openssh,
data_disk = var.data_disk != null data_disk = var.data_disk != null
fixed_dns = var.fixed_dns
}) })
cloudinit_network_config = templatefile("${path.module}/files/network_config.cfg.tftpl", { cloudinit_network_config = templatefile("${path.module}/files/network_config.cfg.tftpl", {
fixed_address = var.fixed_address fixed_address = var.fixed_address

View file

@ -74,3 +74,8 @@ variable "ansible_command" {
type = string type = string
default = "true" default = "true"
} }
variable "fixed_dns" {
type = string
default = ""
}