Creating VM from Template is Failing

SUMMARY

We are trying to create VM from template.
I am facing issue at assigning ip line.

ISSUE TYPE- Documentation Report
COMPONENT NAME

vsphere_guest:

ANSIBLE VERSION
ansible 2.5.2

CONFIGURATION##### OS / ENVIRONMENT

Ubuntu

STEPS TO REPRODUCE
---

- hosts: 127.0.0.1
  connection: local
  user: root
  sudo: false
  gather_facts: false
  serial: 1

  tasks:
  - name: Importing Variables
    include_vars: main.yml
  - debug: var=hostname_var
  - debug: var=username_var
  - debug: var=password_var

  - vsphere_guest:
       vcenter_hostname: "{{hostname_var}}"
       username: "{{username_var}}"
       password: "{{password_var}}"
       guest: vmfromtemplate
       from_template: yes
       template_src: Ubuntu VM
       cluster: t1k1-cluster
    networks:
      - name: "vcesys_esx_mgmt"
         ip: "10.1.1.10"
        netmask: "255.255.255.0"
        gateway: "10.0.0.1"
    wait_for_ip_address: yes
~

EXPECTED RESULTS

VMshould be created from template and assigned the ip for the interface which i am giving at the ntework line.

ACTUAL RESULTS
ERROR! Syntax Error while loading YAML.
  did not find expected key

The error appears to have been in '/opt/work/ansible/playbooks/gowtham/vmfromtem                                                                                                             plate.yml': line 27, column 10, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

      - name: "vcesys_esx_mgmt"
         ip: "10.1.1.10"
         ^ here

Please check the indentation after the line “ip” - 28 and 29

-Bijay

networks:
      - name: "vcesys_esx_mgmt"
        ip: "10.1.1.10"
        netmask: "255.255.255.0"
        gateway: "10.0.0.1"
Try this out