Skip to content

Commit

Permalink
[ocp4_workload_virt_roadshow_vmware] Using vcenter_folder_info instea…
Browse files Browse the repository at this point in the history
…d folder_moid (#8551)

* [ocp4_workload_virt_roadshow_vmware] Using vcenter_folder_info instead folder_moid

We are hitting the following bug:

ansible-collections/vmware.vmware_rest#324

This is a workaround till new version of the vmware.vmware_rest will be released

* Update vcenter_setup_create_folder_and_vms.yml

* Update vcenter_setup_create_folder_and_vms.yml
  • Loading branch information
agonzalezrh authored Sep 15, 2024
1 parent 1b43347 commit cd87510
Showing 1 changed file with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,27 @@
ansible.builtin.debug:
msg: "vcenter folder: {{ r_vcenter_folder }}"

# Bug: https://github.com/ansible-collections/vmware.vmware_rest/issues/324
# - name: Set folder ID fact
# ansible.builtin.set_fact:
# _ocp4_workload_virt_roadshow_vmware_vcenter_folder_id: >-
# {{ lookup('vmware.vmware_rest.folder_moid',
# '/' + vcenter_datacenter + '/vm/Workloads/' + _ocp4_workload_virt_roadshow_vmware_vcenter_folder,
# **_ocp4_workload_virt_roadshow_vmware_connection_args) }}
# retries: 10
# delay: 15
# until: _ocp4_workload_virt_roadshow_vmware_vcenter_folder_id | length > 0
#
- name: Get folder information
vmware.vmware_rest.vcenter_folder_info:
type: VIRTUAL_MACHINE
names:
- "{{ _ocp4_workload_virt_roadshow_vmware_vcenter_folder }}"
register: r_folder_info

- name: Set folder ID fact
ansible.builtin.set_fact:
_ocp4_workload_virt_roadshow_vmware_vcenter_folder_id: >-
{{ lookup('vmware.vmware_rest.folder_moid',
'/' + vcenter_datacenter + '/vm/Workloads/' + _ocp4_workload_virt_roadshow_vmware_vcenter_folder,
**_ocp4_workload_virt_roadshow_vmware_connection_args) }}
retries: 10
delay: 5
until: _ocp4_workload_virt_roadshow_vmware_vcenter_folder_id | length > 0
set_fact:
_ocp4_workload_virt_roadshow_vmware_vcenter_folder_id: "{{ r_folder_info.value[0].folder }}"

- name: Create VMs
environment:
Expand Down

0 comments on commit cd87510

Please sign in to comment.