Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vmware_export_ovf: add export with extra config support #1161

Merged
merged 4 commits into from
Dec 29, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/vmware_export_ovf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- vmware_export_ovf - Add a new parameter 'export_with_extraconfig' to support export extra config options in ovf (https://github.com/ansible-collections/community.vmware/pull/1161).
12 changes: 11 additions & 1 deletion plugins/modules/vmware_export_ovf.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@
description:
- Export an ISO image of the media mounted on the CD/DVD Drive within the virtual machine.
type: bool
export_with_extraconfig
default: false
description:
- All extra configuration options are exported for a virtual machine.
version_added: '1.18.0'
mariolenz marked this conversation as resolved.
Show resolved Hide resolved
download_timeout:
description:
- The user defined timeout in second of exporting file.
Expand Down Expand Up @@ -209,7 +214,7 @@ def download_device_files(self, headers, temp_target_disk, device_url, lease_upd
def export_to_ovf_files(self, vm_obj):
self.create_export_dir(vm_obj=vm_obj)
export_with_iso = False
if 'export_with_images' in self.params and self.params['export_with_images']:
if self.params['export_with_images']:
export_with_iso = True
self.download_timeout = self.params['download_timeout']

Expand Down Expand Up @@ -284,6 +289,10 @@ def export_to_ovf_files(self, vm_obj):
ovf_parameters = vim.OvfManager.CreateDescriptorParams()
ovf_parameters.name = ovf_descriptor_name
ovf_parameters.ovfFiles = ovf_files
if self.params['export_with_extraconfig']:
ovf_parameters.exportOption = ['extraconfig']
if self.params['export_with_images']:
ovf_parameters.includeImageFiles = True
vm_descriptor_result = ovf_manager.CreateDescriptor(obj=vm_obj, cdp=ovf_parameters)
if vm_descriptor_result.error:
http_nfc_lease.HttpNfcLeaseAbort()
Expand Down Expand Up @@ -325,6 +334,7 @@ def main():
datacenter=dict(type='str', default='ha-datacenter'),
export_dir=dict(type='path', required=True),
export_with_images=dict(type='bool', default=False),
export_with_extraconfig=dict(type='bool', default=False),
download_timeout=dict(type='int', default=30),
)

Expand Down