Ansible, vmware_guest, customvalues syntax

ansiblevmware-esxi

I've tried this every way I can think of and it refuses to set the "customvalues" on the VM.

- name: Cloning VM
  vmware_guest:
   validate_certs: no
   hostname: "{{ vcenterhostname }}"
   username: "{{ vcusername }}"
   ...

   template: "{{ item.key }}"
   name: new_vm0001
   customvalues:
    - remotedisplay.vnc.port: 6021
  state: restarted
  when:
    - item.key | search('-sourcevm')
with_dict: "{{ vmfacts.virtual_machines }}"
delegate_to: localhost

Has anyone been able to successfully set customvalues?

Using ansible 2.4, I suppose it could be broken but more likely I don't have the syntax correct.

Best Answer

  1. Use your favourite search engine to locate vmware_guest module manual

  2. Read:

    customvalues

    Define a list of customvalues to set on VM.

    A customvalue object takes 2 fields key and value.

  3. Implement:

    customvalues:
      - key: remotedisplay.vnc.port
        value: 6021