packer-examples-for-vsphere
packer-examples-for-vsphere copied to clipboard
Add support for builds using static IP address assignment
Code of Conduct
- [X] I have read and agree to the project's Code of Conduct.
Description
Add support for builds using static IP address assignment.
Use Case(s)
Provides examples for environments that are unable to use DHCP (default).
Potential Configuration
To be determined.
There's not a native method in the Packer Builder for VMware vSphere to use static IP address assignment.
Options to enable this may include:
Examples
Ubuntu 18.04
Update the ks.cfg preseed file.
# Networking
d-i netcfg/disable_autoconfig boolean true
# IPv4 Setup
d-i netcfg/get_ipaddress string <static_ipv4_address>
d-i netcfg/get_netmask string <static_ipv4_netmask>
d-i netcfg/get_gateway string <static_ipv4_gateways>
d-i netcfg/get_nameservers string <static_ipv4_dnsservers>
d-i netcfg/confirm_static boolean true
Ubuntu 20.04 and later
Update the user-data used by cloud-init.
network:
network:
version: 2
ethernets:
ens33:
addresses: <static_ipv4_address_cidr>
gateway4: <static_ipv4_gateway>
nameservers:
addresses: [<static_ipv4_dnsservers>]
Windows Server
Update the autounattend.xml with Ipv4Settings.
<component name="Microsoft-Windows-TCPIP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Interfaces>
<Interface wcm:action="add">
<Ipv4Settings>
<DhcpEnabled>false</DhcpEnabled>
</Ipv4Settings>
<Ipv6Settings>
<DhcpEnabled>false</DhcpEnabled>
</Ipv6Settings>
<Identifier>Ethernet0</Identifier>
<UnicastIpAddresses>
<IpAddress wcm:action="add" wcm:keyValue="1"><!--REPLACE WITH IPCIDR--></IpAddress>
</UnicastIpAddresses>
<Routes>
<Route wcm:action="add">
<Identifier>1</Identifier>
<Prefix>0.0.0.0/0</Prefix>
<NextHopAddress><!--REPLACE WITH GATEWAY--></NextHopAddress>
</Route>
</Routes>
</Interface>
</Interfaces>
</component>
</component>
References
None.