Question

How to Assign a Static IP for a Cloned VM using API V3?

  • 2 March 2022
  • 0 replies
  • 182 views

I am cloning a VM using API V3, by default it was set to DHCP, I want to assign a Static IP via  below code, but it is not working. i am not interested to do this Via sysprep file.

 
  "override_spec":
    {
      "memory_size_mib": 4096,
      "name": "{{ vm_name }}",
      "num_sockets": 1,
      "num_vcpus_per_socket": 2,
      "num_threads_per_core": 1,
      "nic_list": [
         {
          "dns_ip_addresses_list": [
            "192.168.1.10",
            "192.168.1.20"
              ],
           "nic_type": "NORMAL_NIC",
           "ip_endpoint_list": [
              {
                "ip": "192.168.1.50",
                "type": "LEARNED",
                "prefix_length": 24,
                "gateway_address_list": [
                  "192.168.1.1"
                    ],
                "ip_type": "STATIC"
                   },
            "subnet_reference": {
                  "kind": "subnet",
                  "name": "Client01",
                  "uuid": "XXXXX-XXXX-XXXXX-XXXXXXX"
                },
                  }
                ],
      "guest_customization":{
        "is_overridable": false,
        "sysprep":{
          "install_type": "PREPARED",
          "unattend_xml": "{{ lookup('file','sysprep_ansible1.xml') }}"
          }
        }
    }


0 replies

Be the first to reply!

Reply