how to make terraform pass static IP information to kvm virtual machine with variables, in a kickstart pxeboot enabled env?
0
votes
0
answers
46
views
I have a kvm host, with bridge network, so the vms get IP info directly from router itself.
I have created a pxeboot env with dnsmasq acting as dhcp proxy, and kickstart as method of installation passed via pxeboot menu. So far all working fine.
but here's the problem, whenever I want to set static IP on a vm, I have to modify kickstart file with IP information. this is manageable for small number of vms, but now I introduced terraform for vm provisioning , and I want IP information to be passed on with use of terraform variables to kickstart file.
so below is line of kickstart with static IP info
network --bootproto=static --device=enp1s0 --ip=192.168.1.220 --netmask=255.255.255.0 --gateway=192.168.1.1 --nameserver=8.8.8.8 --noipv6 --activate
and here's variables that I have defined in terraform code
variable "vm_ip" {
default = "192.168.1.200"
}
variable "vm_netmask" {
default = "255.255.255.0"
}
variable "gat_eway" {
default = "192.168.1.1"
}
variable "name_server" {
default = "8.8.8.8"
}
any idea how to pass these variables to kickstart, so vm can get static IP with use of terraform variables?
Asked by Sollosa
(1993 rep)
Feb 3, 2025, 06:48 PM
Last activity: Feb 3, 2025, 08:11 PM
Last activity: Feb 3, 2025, 08:11 PM