theoneakta
Contributor
Contributor

vmware_guest ansible setup server hostname

Hi

 

I am working with ansible and able to create a vm, but i am not able to set up the server hostname

 

Does the module have a trigger for that?

 

if not how can i do that?

```

nameDeploy Ubuntu VM
  vmware_guest:
    hostname"{{ vcenter_server }}"
    username"{{ vcenter_user }}"
    password"{{ vcenter_pass }}"
    validate_certsno
    name"{{ item.vmname }}"
    statepoweredon
    guest_idubuntu64Guest
    cluster"{{ item.cluster }}"
    datacenter"{{ item.datacenter }}"
    folder"{{ item.folder}}"
    disk:
    - size_gb"{{ item.disk }}"
      typethin
      datastore"{{ item.store }}"
    hardware:
      memory_mb"{{ item.ram }}"
      num_cpus"{{ item.cpu }}"
      num_cpu_cores_per_socket"{{ item.cores }}"
      scsiparavirtual
    networks:
      - name"{{ item.netname }}"
        ip"{{ ip_address }}"
        netmask"{{ item.netmask }}"
        gateway"{{ item.gateway }}"
        dns_servers"{{ item.dns }}"
        start_connectedTrue
        device_typevmxnet3
    cdrom:
      typeiso
      iso_path"[{{ item.store }}] {{ DatastoreDir }}/{{ UbuntuNewISO }}"
    annotation| 
                *** Auto-Deployed by Ansible ***
                Username: {{ UbuntuOSUser }}
                Password: {{ UbuntuOSPassword }}
```
p.s i am looping so i can create more than one vm
 
also "name:" give the vm a name but not the hostname
 

Thanks

 

Theoneakta

0 Kudos
0 Replies