diff --git a/roles/virtualization/tasks/vmware.yml b/roles/virtualization/tasks/vmware.yml index 945c150..8afe1ca 100644 --- a/roles/virtualization/tasks/vmware.yml +++ b/roles/virtualization/tasks/vmware.yml @@ -17,8 +17,15 @@ community.vmware.vmware_guest: "{{ _vmware_auth }}" community.vmware.vmware_guest_tpm: "{{ _vmware_auth }}" vmware.vmware.vm_powerstate: "{{ _vmware_auth }}" + vmware.vmware.folder: "{{ _vmware_auth }}" block: - # community.vmware: full-featured guest management + # vmware_guest places into folder but will not create it; ensure it exists first. + - name: Ensure target folder exists + when: system_cfg.path | string | length > 0 + vmware.vmware.folder: + absolute_path: "/{{ hypervisor_cfg.datacenter }}/vm/{{ system_cfg.path | regex_replace('^/+', '') }}" + state: present + - name: Create VM in vCenter vars: virtualization_vmware_networks: >- @@ -98,7 +105,6 @@ fail_msg: "Failed to add vTPM2 to VM '{{ hostname }}'. LUKS with TPM2 requires a virtual TPM device." quiet: true - # vmware.vmware: modern collection for power operations - name: Start VM in vCenter when: virtualization_tpm2_enabled | bool vmware.vmware.vm_powerstate: