vmware_guest module hdd resize & networking

Hi There,

This is my first time digging around here and I am not sure if this is a bug or if I am missing somehting. In case this is a bug I would happily open a bug report.

I have been using/testing the vmware_guest plugin to create new VM’s from template. We have an Vsphere 6.0 environment and I am testing this with CentOS 6 and CentOS 7.

Now I know that, given I have a template which was created with lets say 16GB disk space, I am not able to create a new VM from this template with less than 16GB disk space. Thats fine.

If I create a new VM using a template, and assign lets say 32GB disk space, what is the expected outcome?

Using cfdisk I can see that the additional space is allocated, but the partition (LVM) is not resized. But I think I remember, that in the past, this was working and the partition was resized as well (I may be wrong though).

I tested this with a lot of settings now and noticed that I used the state “poweredon” all the time instead of “present”(as the docs say “If state is set to present and VM exists, ensure the VM configuration conforms to task arguments”). But even when I changed it to “present” again, this did not work either.

Tested with Ansible version 2.3.0 & 2.3.1.

Code is as follow:


  • name: Create VM
    vmware_guest:
    hostname: “{{ vsphere_hostname }}”
    username: “{{ vsphere_username }}”
    password: “{{ vsphere_password }}”
    cluster: “{{ vsphere_cluster }}”
    datacenter: “{{ vsphere_dc }}”
    folder: “{{ vm_folder }}”
    name: “{{ vm_hostname }}”
    state: “{{ vm_state }}”
    validate_certs: False
    guest_id: centos64Guest
    disk:
  • size_gb: “{{ vm_hdd_size }}”
    type: thin
    autoselect_datastore: true
    hardware:
    memory_mb: “{{ vm_mem_mb }}”
    num_cpus: “{{ vm_num_cpu }}”
    scsi: paravirtual
    template: “{{ vm_template }}”
    wait_for_ip_address: yes

Also network settings are not getting passed through to the VM (IP, Subnet, …). I worked around this using vmware_shell

Cheers,

Mike