community.vmware icon indicating copy to clipboard operation
community.vmware copied to clipboard

Problem to deploy ovf to a folder.

Open Kronk74 opened this issue 3 years ago • 4 comments

SUMMARY

Hello,

I'm trying to deploy a ova file to my cluster with this configuration :

tasks:
  - name: Deploy virtual machine from OVF
      community.vmware.vmware_deploy_ovf:
        username: "{{ vcenter.username }}"
        password: "{{ vcenter.password }}"
        folder: "Test-Folder"
        hostname: "{{ vcenter.url }}"
        esxi_hostname: "{{ item[1].esxi }}"
        datacenter: "{{ vcenter.datacenter }}"
        name: "{{ item[1].name }}"
        power_on: false
        ovf: "{{ playbook_dir }}/files/machine.ova"
        networks:
          "VM Network": "{{ vcenter.network }}"
      register: deployed_vms
      loop: "{{ ovf_vms | dict2items | subelements('value')}}"
      tags: ovf
ISSUE TYPE

I get this error message :

"msg": "Unable to find the specified folder Test-Folder"

The problem is that with vmware_guest module there's no problem to find the folder.

COMPONENT NAME

deploy_ovf

ANSIBLE VERSION
ansible [core 2.12.5.post0]
  config file = /home/tramon/test-openshift-install/pre-existing/ansible.cfg
  configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
  ansible collection location = /home/runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.8.13 (default, Jun 24 2022, 15:27:57) [GCC 8.5.0 20210514 (Red Hat 8.5.0-13)]
  jinja version = 2.11.3
  libyaml = True
COLLECTION VERSION
Collection       Version
---------------- -------
community.vmware 2.9.1
CONFIGURATION
CACHE_PLUGIN(env: ANSIBLE_CACHE_PLUGIN) = jsonfile
CACHE_PLUGIN_CONNECTION(env: ANSIBLE_CACHE_PLUGIN_CONNECTION) = /runner/artifacts/3543a63f-8c0c-497d-988f-7c3859857b63/fact_cache
DEFAULT_CALLBACK_PLUGIN_PATH(env: ANSIBLE_CALLBACK_PLUGINS) = ['/runner/artifacts/3543a63f-8c0c-497d-988f-7c3859857b63/callback']
DEFAULT_HOST_LIST(/home/test/test-install/pre-existing/ansible.cfg) = ['/home/test/test-install/pre-existing/inventor']
DEFAULT_STDOUT_CALLBACK(env: ANSIBLE_STDOUT_CALLBACK) = awx_display
DEFAULT_VAULT_PASSWORD_FILE(/home/test/test-install/pre-existing/ansible.cfg) = /home/test/test-install/pre-existing/.vault_secret
HOST_KEY_CHECKING(env: ANSIBLE_HOST_KEY_CHECKING) = False
RETRY_FILES_ENABLED(env: ANSIBLE_RETRY_FILES_ENABLED) = False
OS / ENVIRONMENT

ovf to deploy : rhcos (coreos)

STEPS TO REPRODUCE
tasks:
  - name: Deploy virtual machine from OVF
      community.vmware.vmware_deploy_ovf:
        username: "{{ vcenter.username }}"
        password: "{{ vcenter.password }}"
        folder: "Test-Folder"
        hostname: "{{ vcenter.url }}"
        esxi_hostname: "{{ item[1].esxi }}"
        datacenter: "{{ vcenter.datacenter }}"
        name: "{{ item[1].name }}"
        power_on: false
        ovf: "{{ playbook_dir }}/files/machine.ova"
        networks:
          "VM Network": "{{ vcenter.network }}"
      register: deployed_vms
      loop: "{{ ovf_vms | dict2items | subelements('value')}}"
      tags: ovf
EXPECTED RESULTS

Machine deployed to the good folder

ACTUAL RESULTS

I've got an error, the folder is not found.

Kronk74 avatar Sep 14 '22 09:09 Kronk74

Files identified in the description: None

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot avatar Sep 14 '22 09:09 ansibullbot

Hi, it seems to be related with pyvmomi-8.x Downgrade to pyvmomi v7.0.3 workaround it.

https://github.com/vmware/pyvmomi/issues/995

q84fh avatar Dec 01 '22 11:12 q84fh

Hi, it seems to be related with pyvmomi-8.x Downgrade to pyvmomi v7.0.3 workaround it.

Since this issue pre-dates pyvmomi 8.0.0.1, it's probably something else.

FYI the problem with pyvmomi 8.0.0.1 might be fixed in 2.10.2 / 3.2.0. I'm not sure, but it might be worth a try to test those versions.

mariolenz avatar Dec 02 '22 09:12 mariolenz

Annoying indeed. I've worked around it by moving it after deployment:

      community.vmware.vmware_deploy_ovf:
      ...
      register: deploy
      
      community.vmware.vmware_guest_move:
      ...
        datacenter: "{{ vars.community_vmware_vmware__guest.datacenter }}"
        dest_folder: "{{ vars.community_vmware_vmware__guest.folder | default('vm') }}"
        moid: "{{ deploy.instance.moid }}"

thomas-biesmans avatar May 11 '23 14:05 thomas-biesmans