From b3a41fcf9e9d48d3e2dbb4f5460195948c3486e2 Mon Sep 17 00:00:00 2001 From: Mike Morency Date: Tue, 8 Oct 2024 11:26:40 -0400 Subject: [PATCH 1/2] remove duplicate vars in docs --- .../105-fix-variables in-export-vm-as-ovf.yml | 3 +++ roles/export_vm_as_ovf/README.md | 11 +++-------- 2 files changed, 6 insertions(+), 8 deletions(-) create mode 100644 changelogs/fragments/105-fix-variables in-export-vm-as-ovf.yml diff --git a/changelogs/fragments/105-fix-variables in-export-vm-as-ovf.yml b/changelogs/fragments/105-fix-variables in-export-vm-as-ovf.yml new file mode 100644 index 00000000..01537b21 --- /dev/null +++ b/changelogs/fragments/105-fix-variables in-export-vm-as-ovf.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - export_vm_as_ovf - Removed duplicate vars in docs, changed datacenter var name to match other roles while maintaining backwards compat diff --git a/roles/export_vm_as_ovf/README.md b/roles/export_vm_as_ovf/README.md index 0ecdf3b4..dda091f2 100644 --- a/roles/export_vm_as_ovf/README.md +++ b/roles/export_vm_as_ovf/README.md @@ -20,18 +20,13 @@ N/A - **export_vm_as_ovf_validate_certs** - Allows connection when SSL certificates are not valid. Set to false when certificates are not trusted. -- **export_vm_as_ovf_cluster_name**: - - The name of the cluster in vSphere vCenter that contains the VM. - -- **export_vm_as_ovf_datacenter_name**: - - The name of the datacenter in vSphere vCenter which contains the VM. - - **export_vm_as_ovf_port**: - str or int, The port used to authenticate to the vSphere vCenter that contains the VM. ### VM Options -- **export_vm_as_ovf_vm_datacenter**: - - str, The name of the datacenter that contains the VM that should be exported. +- **export_vm_as_ovf_datacenter**: + - The name of the datacenter in vSphere vCenter which contains the VM. + - Aliases: [export_vm_as_ovf_datacenter_name] - **export_vm_as_ovf_vm_folder**: - str, The vCenter folder that contains the VM that should be exported. This should be the full folder path From 5a131b9c8e31b152bdce5ea91b63c3d64639564c Mon Sep 17 00:00:00 2001 From: Mike Morency Date: Tue, 8 Oct 2024 11:26:55 -0400 Subject: [PATCH 2/2] update datacenter var name to match other roles --- roles/export_vm_as_ovf/tasks/main.yml | 7 ++++++- .../vmware_ops_export_vm_as_ovf_test/tasks/main.yml | 2 +- .../targets/vmware_ops_export_vm_as_ovf_test/vars/main.yml | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/roles/export_vm_as_ovf/tasks/main.yml b/roles/export_vm_as_ovf/tasks/main.yml index c15a6689..d875c6e3 100644 --- a/roles/export_vm_as_ovf/tasks/main.yml +++ b/roles/export_vm_as_ovf/tasks/main.yml @@ -13,6 +13,11 @@ quiet: true fail_msg: Variable must be set when using this role. +- name: Map Variable Aliases to Documented Names + ansible.builtin.set_fact: + export_vm_as_ovf_vm_datacenter: "{{ export_vm_as_ovf_vm_datacenter_name }}" + when: export_vm_as_ovf_vm_datacenter_name is defined + - name: Export VM As OVF community.vmware.vmware_export_ovf: hostname: "{{ export_vm_as_ovf_hostname }}" @@ -23,7 +28,7 @@ proxy_host: "{{ export_vm_as_ovf_proxy_host | default(omit) }}" proxy_port: "{{ export_vm_as_ovf_proxy_port | default(omit) }}" - datacenter: "{{ export_vm_as_ovf_vm_datacenter_name | default(omit) }}" + datacenter: "{{ export_vm_as_ovf_vm_datacenter | default(omit) }}" folder: "{{ export_vm_as_ovf_vm_folder | default(omit) }}" name: "{{ export_vm_as_ovf_vm_name | default(omit) }}" uuid: "{{ export_vm_as_ovf_vm_uuid | default(omit) }}" diff --git a/tests/integration/targets/vmware_ops_export_vm_as_ovf_test/tasks/main.yml b/tests/integration/targets/vmware_ops_export_vm_as_ovf_test/tasks/main.yml index 5df558f9..b9dff062 100644 --- a/tests/integration/targets/vmware_ops_export_vm_as_ovf_test/tasks/main.yml +++ b/tests/integration/targets/vmware_ops_export_vm_as_ovf_test/tasks/main.yml @@ -15,7 +15,7 @@ name: "{{ export_vm_as_ovf_vm_name }}" state: poweredoff folder: "/{{ vcenter_datacenter }}/vm/e2e-qe" - datacenter: "{{ export_vm_as_ovf_datacenter_name }}" + datacenter: "{{ export_vm_as_ovf_datacenter }}" disk: - size_gb: 5 type: thick diff --git a/tests/integration/targets/vmware_ops_export_vm_as_ovf_test/vars/main.yml b/tests/integration/targets/vmware_ops_export_vm_as_ovf_test/vars/main.yml index c15ca36d..e4119e24 100644 --- a/tests/integration/targets/vmware_ops_export_vm_as_ovf_test/vars/main.yml +++ b/tests/integration/targets/vmware_ops_export_vm_as_ovf_test/vars/main.yml @@ -5,7 +5,7 @@ export_vm_as_ovf_hostname: "{{ vcenter_hostname }}" export_vm_as_ovf_username: "{{ vcenter_username }}" export_vm_as_ovf_password: "{{ vcenter_password }}" export_vm_as_ovf_validate_certs: false -export_vm_as_ovf_datacenter_name: "{{ vcenter_datacenter }}" +export_vm_as_ovf_datacenter: "{{ vcenter_datacenter }}" export_vm_as_ovf_export_dir: /tmp/export_vm_as_ovf export_vm_as_ovf_vm_name: "{{ tiny_prefix }}-export-vm-as-ovf-test"