title: Why am I getting the 'delegate_to' is not a valid attribute for a Play error in Ansible
body: <p>I pulled the code from the ansible docs site <a href="https://docs.ansible.com/ansible/latest/modules/vmware_guest_module.html#examples" rel="nofollow noreferrer">here</a>. </p>
  
  <pre><code>- name: Create a virtual machine on given ESXi hostname
    vmware_guest:
      hostname: "{{ vcenter_hostname }}"
      username: "{{ vcenter_username }}"
      password: "{{ vcenter_password }}"
      validate_certs: no
      folder: /DC1/vm/
      name: test_vm_0001
      state: poweredon
      guest_id: centos64Guest
      # This is hostname of particular ESXi server on which user wants VM to be deployed
      esxi_hostname: "{{ esxi_hostname }}"
      disk:
      - size_gb: 10
        type: thin
        datastore: datastore1
      hardware:
        memory_mb: 512
        num_cpus: 4
        scsi: paravirtual
      networks:
      - name: VM Network
        mac: aa:bb:dd:aa:00:14
        ip: 10.10.10.100
        netmask: 255.255.255.0
        device_type: vmxnet3
      wait_for_ip_address: yes
    delegate_to: localhost
    register: deploy_vm
  </code></pre>
  
  <p>When I save the text to a file and try to run it, i get this error:</p>
  
  <p><a href="https://i.stack.imgur.com/zcQiv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zcQiv.png" alt="enter image description here"></a></p>