Skip to content

Commit

Permalink
vmware_guest_tools_upgrade: New parameter installer_options
Browse files Browse the repository at this point in the history
  • Loading branch information
mariolenz committed Jan 5, 2024
1 parent 532250b commit c8e82c3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelogs/fragments/1059-vmware_guest_tools_upgrade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- vmware_guest_tools_upgrade - Add parameter `installer_options` to pass command line options to the installer to modify the installation procedure for tools
(https://github.com/ansible-collections/community.vmware/pull/1059).
14 changes: 13 additions & 1 deletion plugins/modules/vmware_guest_tools_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@
default: false
type: bool
required: false
installer_options:
version_added: '4.1.0'
description:
- Command line options passed to the installer to modify the installation procedure for tools.
default: false
type: str
required: false
extends_documentation_fragment:
- community.vmware.vmware.documentation
Expand Down Expand Up @@ -151,8 +158,12 @@ def upgrade_tools(self, vm):
elif vm.guest.toolsStatus == "toolsOld":
try:
force = self.module.params.get('force_upgrade')
installer_options = self.module.params.get('installer_options')
if force or vm.guest.guestFamily in ["linuxGuest", "windowsGuest"]:
task = vm.UpgradeTools()
if installer_options is not None:
task = vm.UpgradeTools(installer_options)
else:
task = vm.UpgradeTools()
changed, err_msg = wait_for_task(task)
result.update(changed=changed, msg=to_native(err_msg))
else:
Expand Down Expand Up @@ -182,6 +193,7 @@ def main():
folder=dict(type='str'),
datacenter=dict(type='str', required=True),
force_upgrade=dict(type='bool', default=False),
installer_options=dict(type='str', default=False),
)
module = AnsibleModule(
argument_spec=argument_spec,
Expand Down

0 comments on commit c8e82c3

Please sign in to comment.