Closed ajgerace closed 4 years ago
You don't create a mapping... ovftool does it. (but only for the first network interface).
The debug output gives you the exact ovftool command that it is running. If you run the ovftool command manually, does it work?
I'm guessing you have 2+ network cards configured in your ova.
ovftool documentation: --network Target network for a vSphere deployment. Use this option in place of the --net option when only one network exists in the OVF package. This option maps the symbolic OVF name to the specified network name.
Have you tried other ova sources?
In the OVA I'm looking to use, it has 4 network interfaces.
Manual deployment with ovftool works without issue.
ovftool --sourceType=OVA --acceptAllEulas --noSSLVerify --skipManifestCheck --X:logToConsole --datastore="datastore" --name="vbigip1" --deploymentOption="dualcpu" --net:"Management=VM Management" --net:"Internal=VM Internal" --net:"External=VM DMZ" --net:"HA=VM Peer" --X:injectOvfEnv --powerOn --prop:"net.mgmt.addr=192.168.0.49/24" --prop:"net.mgmt.gw=192.168.0.1"
--prop:"user.root.pwd=#password#" --prop:"user.admin.pwd=#password#" BIGIP-15.1.0.1-0.0.4.ALL-vmware-edited.ova "vi://root@192.168.1.250:443/"
In the link you provided it says to use --net instead of --network in order to support multiple network mappings. For multiple network mappings, repeat the option, separating them with a space for example, --net:s1=t1 --net:s2=t2 --net:s3=t3.
I seem to remember looking at the --net vs --network options when I first started working on this project... Maybe there is a solution now, but I remember a problem.
If your ova/ovf has 4 networks defined and you're cloning it, (but only need 1, or 5), then it fails.
If you can run a manual test for me please. You gave the "manual deployment" example above.
I currently use the --network option to configure the first network, then the (optional) network interfaces are added to the vmx file.
if I only specify one --net
sudo ovftool --sourceType=OVA --acceptAllEulas --noSSLVerify --skipManifestCheck --X:logToConsole --datastore="datastore" --name="vbigip2" --deploymentOption="dualcpu" --net:"Management=VM Management" --X:injectOvfEnv --powerOn --prop:"net.mgmt.addr= 192.168.0.50/24" --prop:"net.mgmt.gw=192.168.0.1" --prop:"user.root.pwd=root" --prop:"user.admin.pwd=admin" BIGIP-15.1.0.1-0.0.4.ALL-vmware-edited.ova "vi://root@192.168.1.250:443/"
The device is created and interfaces 2 - 4 are connected to the "VM Network" port group (connected to vSwitch0)
if you specify five --net options, it fails as the OVA only specifies 4 network names.
Error: Invalid OVF name (Network) specified in net mapping. OVF networks: External HA Internal Management. Target networks: VM DMZ VM Internal VM Management VM Network VM Peer
On Fri, Mar 6, 2020 at 8:28 PM Jonathan Senkerik notifications@github.com wrote:
I seem to remember looking at the --net vs --network options when I first started working on this project... Maybe there is a solution now, but I remember a problem.
-
If your ova/ovf has 4 networks defined and you're cloning it, (but only need 1, or 5), then it fails.
If you can run a manual test for me please. You gave the "manual deployment" example above.
- What happens if you only specify only one --net option?
- What happens if you specify five --net options?
- Can you determine via command line how many network interfaces are defined in your ova and what are their names?
I currently use the --network option to configure the first network, then the (optional) network interfaces are added to the vmx file.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/josenk/terraform-provider-esxi/issues/103?email_source=notifications&email_token=AF3UGCMCBENB4BIDXMVXCEDRGGPKVA5CNFSM4LAHX732YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEODKY3A#issuecomment-596028524, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF3UGCMRXDWGX2TGKEX3MHLRGGPKVANCNFSM4LAHX73Q .
So that's why I cannot use --net option... If you have multiple networks in your ova, you cannot scale up or down the number of interfaces. Using the --network option will configure 1 network interface, then the plugin does the rest.
The source ova must have only 1 network interface defined in it.
I am trying to create a guest with 4 network interfaces. According to your documentation I created the following: resource "esxi_guest" "bigip1" { guest_name = "bigip1" disk_store = var.disk_store
network_interfaces { virtual_network = var.Management nic_type = "vmxnet3" }
network_interfaces { virtual_network = var.Internal nic_type = "vmxnet3"
}
network_interfaces { virtual_network = var.External nic_type = "vmxnet3" }
network_interfaces { virtual_network = var.HA nic_type = "vmxnet3" }
ovf_source = var.bigip_ova_file } output from terraform plan Terraform will perform the following actions:
esxi_guest.bigip1 will be created
resource "esxi_guest" "bigip1" {
boot_disk_size = (known after apply)
disk_store = "datastore"
guest_name = "bigip1"
guest_shutdown_timeout = (known after apply)
guest_startup_timeout = (known after apply)
guestos = (known after apply)
id = (known after apply)
ip_address = (known after apply)
memsize = (known after apply)
notes = (known after apply)
numvcpus = (known after apply)
ovf_properties_timer = (known after apply)
ovf_source = "BIGIP-15.1.0.1-0.0.4.ALL-vmware-edited.ova"
power = "on"
resource_pool_name = (known after apply)
virthwver = (known after apply)
network_interfaces {
network_interfaces {
network_interfaces {
network_interfaces {
ovf_properties {
ovf_properties {
When I run terraform apply I receive the following error. 2020-03-03T05:46:45.014-0500 [DEBUG] plugin.terraform-provider-esxi_v1.6.3: pid-20087-guest-create.go:289: [guestCREATE] ovf_cmd: ovftool --acceptAllEulas --noSSLVerify --X:useMacNaming=false --X:injectOvfEnv --allowExtraConfig --powerOn --prop:net.mgmt.addr='192.168.0.48/24' --prop:net.mgmt.gw='192.168.0.1' -dm=thin --name='bigip1' --overwrite -ds='datastore' --network='VM Management' 'BIGIP-15.1.0.1-0.0.4.ALL-vmware-edited.ova' 'vi://XXXX:YYYY@io/' 2020/03/03 05:46:45 [DEBUG] esxi_guest.bigip1: apply errored, but we're indicating that via the Error pointer rather than returning it: There was an ovftool Error: Opening OVA source: BIGIP-15.1.0.1-0.0.4.ALL-vmware-edited.ova The manifest validates Opening VI target: vi://root@192.168.1.250:443/ Error: No network mapping specified. OVF networks: External HA Internal Management. Target networks: VM DMZ VM Internal VM Management VM Network VM Peer Completed with errors
How do I create this mapping with your provider?