diff --git a/changelogs/fragments/1059-vmware_guest_tools_upgrade.yml b/changelogs/fragments/1059-vmware_guest_tools_upgrade.yml new file mode 100644 index 0000000000..4d418b9e92 --- /dev/null +++ b/changelogs/fragments/1059-vmware_guest_tools_upgrade.yml @@ -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). diff --git a/plugins/modules/vmware_guest_tools_upgrade.py b/plugins/modules/vmware_guest_tools_upgrade.py index 0aa38b7547..80f7cf3b8b 100644 --- a/plugins/modules/vmware_guest_tools_upgrade.py +++ b/plugins/modules/vmware_guest_tools_upgrade.py @@ -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 @@ -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: @@ -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,