From 0eadf8fba9b5ea883559b58f87b3295cad2258ee Mon Sep 17 00:00:00 2001 From: AJ Schroeder <6432150+ajschroeder@users.noreply.github.com> Date: Sat, 29 Jun 2024 10:23:06 -0500 Subject: [PATCH] feat: add network templates and vars --- .../centos/9-stream/data/network.pkrtpl.hcl | 5 +++ .../centos/9-stream/variables-network.pkr.hcl | 36 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 builds/linux/centos/9-stream/data/network.pkrtpl.hcl create mode 100644 builds/linux/centos/9-stream/variables-network.pkr.hcl diff --git a/builds/linux/centos/9-stream/data/network.pkrtpl.hcl b/builds/linux/centos/9-stream/data/network.pkrtpl.hcl new file mode 100644 index 0000000..64aaf4f --- /dev/null +++ b/builds/linux/centos/9-stream/data/network.pkrtpl.hcl @@ -0,0 +1,5 @@ +%{ if ip != null ~} +network --device=${device} --bootproto=static --ip=${ip} --netmask=${cidrnetmask("${ip}/${netmask}")} --gateway=${gateway} --nameserver=${join(",", dns)} +%{ else ~} +network --device=${device} --bootproto=dhcp +%{ endif ~} \ No newline at end of file diff --git a/builds/linux/centos/9-stream/variables-network.pkr.hcl b/builds/linux/centos/9-stream/variables-network.pkr.hcl new file mode 100644 index 0000000..9c2129d --- /dev/null +++ b/builds/linux/centos/9-stream/variables-network.pkr.hcl @@ -0,0 +1,36 @@ +/* + DESCRIPTION: + CentOS Stream 9 network variables used by the Packer Plugin for Proxmox (proxmox-iso). +*/ + +// VM Network Settings + +variable "vm_network_device" { + type = string + description = "The network device of the VM." + default = "ens192" +} + +variable "vm_ip_address" { + type = string + description = "The IP address of the VM (e.g. 172.16.100.192)." + default = null +} + +variable "vm_ip_netmask" { + type = number + description = "The netmask of the VM (e.g. 24)." + default = null +} + +variable "vm_ip_gateway" { + type = string + description = "The gateway of the VM (e.g. 172.16.100.1)." + default = null +} + +variable "vm_dns_list" { + type = list(string) + description = "The nameservers of the VM." + default = [] +}