Skip to content

Commit

Permalink
add one parameter to utility win_execute_cmd.yml
Browse files Browse the repository at this point in the history
Signed-off-by: Yanan Shen <yanans@vmware.com>
  • Loading branch information
123lzxm committed Jan 9, 2024
1 parent 9ddc7d7 commit 53a2da8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
13 changes: 9 additions & 4 deletions windows/utils/win_execute_cmd.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: BSD-2-Clause
---
# Execute specified powershell command in Windows guest OS
# Execute specified PowerShell command in Windows guest OS
# Parameters:
# win_powershell_cmd: powershell command
# win_powershell_cmd: PowerShell command
# win_execute_cmd_ignore_error: true or false
# win_execute_cmd_no_log: true or false, default false.
# Return:
# win_powershell_cmd_output
#
Expand All @@ -15,6 +16,10 @@
- win_powershell_cmd
fail_msg: "Parameter 'win_powershell_cmd' is not specified"

- name: "Set the fact if the output of PowerShell command execution is needed"
ansible.builtin.set_fact:
win_execute_cmd_no_log: "{{ win_execute_cmd_no_log | default(false) }}"

- name: "Initialize the command execution result"
ansible.builtin.set_fact:
win_powershell_cmd_output: ""
Expand All @@ -25,7 +30,7 @@
ignore_errors: "{{ win_execute_cmd_ignore_error | default(false) }}"
delegate_to: "{{ vm_guest_ip }}"
ignore_unreachable: true
no_log: "{{ hide_secrets | default(false) }}"
no_log: win_execute_cmd_no_log

- name: "Test VM and guest connection when guest unreachable"
block:
Expand All @@ -52,4 +57,4 @@
- name: "Display the PowerShell commmand result"
ansible.builtin.debug: var=win_powershell_cmd_output
when: enable_debug
no_log: "{{ hide_secrets | default(false) }}"
no_log: win_execute_cmd_no_log
1 change: 1 addition & 0 deletions windows/windows_update_install/prepare_msu_file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
{{ win_nfs_mount_cmd }};
Copy-Item -Path {{ msu_file_src_path }} -Include *.msu -Destination {{ msu_dir_path }} -ErrorAction Stop;
net use {{ drive_letter_new }}: /delete
win_execute_cmd_no_log: "{{ hide_secrets | default(false) }}"

- name: "Get the .msu file name"
include_tasks: ../utils/win_execute_cmd.yml
Expand Down

0 comments on commit 53a2da8

Please sign in to comment.