Skip to content

Commit f85e8c9

Browse files
authored
fix ansible_job_id not defined issue (#359)
Signed-off-by: Diane Wang <[email protected]>
1 parent ebd5e3a commit f85e8c9

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

windows/wintools_complete_install_verify/install_vmtools.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
# Copyright 2021-2022 VMware, Inc.
22
# SPDX-License-Identifier: BSD-2-Clause
33
---
4-
- name: Set fact of VMware tools silent install command for 64bit GOS
4+
- name: "Set fact of VMware tools silent install command for 64bit GOS"
55
ansible.builtin.set_fact:
66
vmtools_install_cmd: "D:\\setup64.exe /s /v ADDLOCAL=ALL /qn REBOOT=R"
77
when:
88
- guest_os_ansible_architecture is defined
99
- guest_os_ansible_architecture == "64-bit"
10-
- name: Set fact of VMware tools silent install command for 32bit GOS
10+
- name: "Set fact of VMware tools silent install command for 32bit GOS"
1111
ansible.builtin.set_fact:
1212
vmtools_install_cmd: "D:\\setup.exe /s /v ADDLOCAL=ALL /qn REBOOT=R"
1313
when:
1414
- guest_os_ansible_architecture is defined
1515
- guest_os_ansible_architecture == "32-bit"
1616

17-
- name: Check the CDROM mounted path folder info
17+
- name: "Check the CDROM mounted path folder info"
1818
include_tasks: ../utils/win_execute_cmd.yml
1919
vars:
2020
win_powershell_cmd: "Get-childitem -path D:\\ -name"
21-
- name: Check VMware tools install files
21+
- name: "Check VMware tools install files"
2222
ansible.builtin.assert:
2323
that:
2424
- "'setup.exe' in win_powershell_cmd_output['stdout_lines']"
@@ -27,8 +27,8 @@
2727
fail_msg: "VMware tools installation setup files are not in D:\\"
2828
success_msg: "VMware tools installation setup files are in D:\\"
2929

30-
- name: Execute VMware tools silent install command in guest
31-
win_shell: "{{ vmtools_install_cmd }}"
30+
- name: "Execute VMware tools silent install command in guest"
31+
ansible.windows.win_shell: "{{ vmtools_install_cmd }}"
3232
delegate_to: "{{ vm_guest_ip }}"
3333
ignore_errors: true
3434
register: wintools_install_result
@@ -38,13 +38,16 @@
3838
ansible.builtin.pause:
3939
minutes: 2
4040
- name: "Check VMware tools install task status every 3 seconds"
41-
async_status:
41+
ansible.builtin.async_status:
4242
jid: "{{ wintools_install_result.ansible_job_id }}"
4343
register: job_result
4444
delegate_to: "{{ vm_guest_ip }}"
45-
until: job_result.finished
45+
until: job_result.finished is defined and job_result.finished
4646
retries: 80
4747
delay: 3
48+
when:
49+
- wintools_install_result is defined
50+
- wintools_install_result.ansible_job_id is defined
4851

4952
- include_tasks: ../utils/win_shutdown_restart.yml
5053
vars:

0 commit comments

Comments
 (0)