diff --git a/linux/guest_customization/check_gosc_log.yml b/linux/guest_customization/check_gosc_log.yml index 8f411f01e..c16aa86bd 100644 --- a/linux/guest_customization/check_gosc_log.yml +++ b/linux/guest_customization/check_gosc_log.yml @@ -14,7 +14,7 @@ dest_path: "{{ gosc_deploypkg_log_local }}" - name: "Check traditional GOSC log in {{ gosc_deploypkg_log_local }}" - when: gosc_workflow == "perl" + when: not enable_cloudinit_gosc include_tasks: check_log_msg.yml vars: check_log_file: "{{ gosc_deploypkg_log_local }}" @@ -27,7 +27,7 @@ loop_var: "check_msg_regexp" - name: "Check cloud-init GOSC log in {{ gosc_deploypkg_log_local }}" - when: gosc_workflow == "cloud-init" + when: enable_cloudinit_gosc include_tasks: check_log_msg.yml vars: check_log_file: "{{ gosc_deploypkg_log_local }}" diff --git a/linux/guest_customization/check_gosc_support_status.yml b/linux/guest_customization/check_gosc_support_status.yml index b7e8447f8..f23607933 100644 --- a/linux/guest_customization/check_gosc_support_status.yml +++ b/linux/guest_customization/check_gosc_support_status.yml @@ -27,12 +27,20 @@ - vcenter_version is version('8.0.0', '<') - name: "Check GOSC support status" + when: + - guest_os_ansible_distribution is defined + - guest_os_ansible_distribution_ver is defined + - vcenter_version is defined and vcenter_version != 'N/A' + - vcenter_build is defined and vcenter_build != 'N/A' block: - name: "Initialize GOSC support status" ansible.builtin.set_fact: gosc_is_supported: true - name: "Check Perl GOSC support status for VMware Photon OS" + when: + - guest_os_ansible_distribution == 'VMware Photon OS' + - not enable_cloudinit_gosc block: - name: "Get open-vm-tools package info" include_tasks: ../utils/get_installed_package_info.yml @@ -52,10 +60,7 @@ vars: skip_msg: "Perl GOSC is not applicable for {{ guest_os_ansible_distribution }} {{ guest_os_ansible_distribution_ver }} with not bundled open-vm-tools {{ vmtools_version }}." skip_reason: "Not Applicable" - when: not gosc_is_supported | bool - when: - - guest_os_ansible_distribution == 'VMware Photon OS' - - not enable_cloudinit_gosc | bool + when: not gosc_is_supported - name: "Set default guest OS list not support GOSC" ansible.builtin.set_fact: @@ -67,6 +72,7 @@ - "Fedora" - "openSUSE Leap" - "RHCOS" + - "Amazon" - name: "Set fact of GOSC support status to False for {{ guest_os_ansible_distribution }}" ansible.builtin.set_fact: @@ -74,6 +80,10 @@ when: guest_os_ansible_distribution in gos_not_support_gosc - name: "Set cloud-init GOSC support status for {{ vm_guest_os_distribution }}" + when: + - enable_cloudinit_gosc + - guest_os_ansible_distribution == "Debian" + - guest_os_ansible_distribution_major_ver | int == 12 block: - name: "Set fact of cloud-init GOSC support status to False for {{ vm_guest_os_distribution }}" ansible.builtin.set_fact: @@ -86,26 +96,35 @@ https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1776452 and https://bugs.launchpad.net/cloud-init/+bug/1944946. So skip cloud-init GOSC testing for {{ vm_guest_os_distribution }}. - when: - - enable_cloudinit_gosc | bool - - guest_os_ansible_distribution == "Debian" - - guest_os_ansible_distribution_major_ver | int == 12 - name: "Check Perl GOSC support status for {{ vm_guest_os_distribution }}" when: - - not enable_cloudinit_gosc | bool + - not enable_cloudinit_gosc - guest_os_ansible_distribution not in gos_not_support_gosc block: - - name: "Get GOSC support matrix" + - name: "Set fact of Perl GOSC support matrix" ansible.builtin.set_fact: gosc_support_matrix: "{{ lookup('file', 'gosc_support_matrix.yml') | from_yaml }}" + - name: "Set fact of Perl GOSC support matrix for {{ guest_os_ansible_distribution }}" + ansible.builtin.set_fact: + guest_gosc_suport_matrix: "{{ gosc_support_matrix[guest_os_ansible_distribution] | default({}) }}" + + # RHEL family OS 9.0 or higher version aligns with GOSC support status for same version of RHEL + - name: "Combine with RedHat family GOSC support status for {{ vm_guest_os_distribution }}" + ansible.builtin.set_fact: + guest_gosc_suport_matrix: "{{ guest_gosc_suport_matrix | combine(gosc_support_matrix[guest_os_family]) }}" + when: + - guest_os_family == "RedHat" + - guest_os_ansible_distribution not in ['RedHat', 'MIRACLE'] + - guest_os_ansible_distribution_major_ver | int >= 9 + - name: "Check Perl GOSC support status for {{ vm_guest_os_distribution }} in support matrix" - when: gosc_support_matrix[guest_os_ansible_distribution] is defined + when: guest_gosc_suport_matrix | length > 0 block: - name: "Get {{ guest_os_ansible_distribution }} Perl GOSC testing supported OS versions" ansible.builtin.set_fact: - gosc_matrix_os_versions: "{{ gosc_support_matrix[guest_os_ansible_distribution] | dict2items | map(attribute='key') }}" + gosc_matrix_os_versions: "{{ guest_gosc_suport_matrix | dict2items | map(attribute='key') }}" gosc_matrix_first_os_version: None - name: "Get the first OS version supporting Perl GOSC testing on {{ guest_os_ansible_distribution }} {{ guest_os_ansible_distribution_ver | int }}.x" @@ -117,35 +136,38 @@ ((guest_os_ansible_distribution_ver | int) > (item | int)) with_items: "{{ gosc_matrix_os_versions }}" + - name: "Display the first OS version supporting Perl GOSC testing for {{ guest_os_ansible_distribution }} {{ guest_os_ansible_distribution_major_ver }}" + ansible.builtin.debug: var=gosc_matrix_first_os_version + - name: "Get Perl GOSC supported VC versions and builds" when: gosc_matrix_first_os_version != 'None' block: - name: "Get {{ guest_os_ansible_distribution }} {{ guest_os_ansible_distribution_ver }} Perl GOSC supported VC versions and builds" ansible.builtin.set_fact: - gosc_matrix_vc_list: "{{ gosc_support_matrix[guest_os_ansible_distribution][gosc_matrix_first_os_version]['vcenter'] | dict2items | map(attribute='key') }}" + gosc_matrix_vc_list: "{{ guest_gosc_suport_matrix[gosc_matrix_first_os_version]['vcenter'] | dict2items | map(attribute='key') }}" - name: "Get {{ guest_os_ansible_distribution }} {{ guest_os_ansible_distribution_ver }} Perl GOSC support status on VC {{ vcenter_version }} build {{ vcenter_build }}" ansible.builtin.set_fact: gosc_is_supported: false when: > (vcenter_version in gosc_matrix_vc_list and - ((gosc_support_matrix[guest_os_ansible_distribution][gosc_matrix_first_os_version]['vcenter'][vcenter_version] == 'N/A') or - (vcenter_build | int < gosc_support_matrix[guest_os_ansible_distribution][gosc_matrix_first_os_version]['vcenter'][vcenter_version] | int)) or + ((guest_gosc_suport_matrix[gosc_matrix_first_os_version]['vcenter'][vcenter_version] == 'N/A') or + (vcenter_build | int < guest_gosc_suport_matrix[gosc_matrix_first_os_version]['vcenter'][vcenter_version] | int)) or (vcenter_version is version(gosc_matrix_vc_list[0], '<'))) - name: "Get Perl GOSC supported open-vm-tools version for {{ vm_guest_os_distribution }}" when: - - gosc_support_matrix[guest_os_ansible_distribution][gosc_matrix_first_os_version]['vmtools'] is defined - - gosc_support_matrix[guest_os_ansible_distribution][gosc_matrix_first_os_version]['vmtools'] + - guest_gosc_suport_matrix[gosc_matrix_first_os_version]['vmtools'] is defined + - guest_gosc_suport_matrix[gosc_matrix_first_os_version]['vmtools'] block: - name: "Get {{ guest_os_ansible_distribution }} {{ guest_os_ansible_distribution_ver }} Perl GOSC supported open-vm-tools version" ansible.builtin.set_fact: - gosc_matrix_vmtools_version: "{{ gosc_support_matrix[guest_os_ansible_distribution][gosc_matrix_first_os_version]['vmtools'] }}" + gosc_matrix_vmtools_version: "{{ guest_gosc_suport_matrix[gosc_matrix_first_os_version]['vmtools'] }}" - name: "Get {{ guest_os_ansible_distribution }} {{ guest_os_ansible_distribution_ver }} Perl GOSC support status with open-vm-tools {{ vmtools_version }}" ansible.builtin.set_fact: gosc_is_supported: false - when: vmtools_version is version(gosc_support_matrix[guest_os_ansible_distribution][gosc_matrix_first_os_version]['vmtools'], '<') + when: vmtools_version is version(guest_gosc_suport_matrix[gosc_matrix_first_os_version]['vmtools'], '<') - name: "Display GOSC support status for {{ vm_guest_os_distribution }}" ansible.builtin.debug: @@ -153,7 +175,7 @@ GOSC is supported for {{ vm_guest_os_distribution }} with open-vm-tools {{ vmtools_version }} on vCenter Server {{ vcenter_version }} build {{ vcenter_build }}. See https://partnerweb.vmware.com/programs/guestOS/guest-os-customization-matrix.pdf. - when: gosc_is_supported | bool + when: gosc_is_supported - name: "Skip test case due to GOSC is not supported for {{ vm_guest_os_distribution }}" include_tasks: ../../common/skip_test_case.yml @@ -164,9 +186,4 @@ vCenter Server {{ vcenter_version }} build {{ vcenter_build }}. See https://partnerweb.vmware.com/programs/guestOS/guest-os-customization-matrix.pdf. skip_reason: "Not Supported" - when: not gosc_is_supported | bool - when: - - guest_os_ansible_distribution is defined - - guest_os_ansible_distribution_ver is defined - - vcenter_version is defined and vcenter_version != 'N/A' - - vcenter_build is defined and vcenter_build != 'N/A' + when: not gosc_is_supported diff --git a/linux/guest_customization/check_network_config.yml b/linux/guest_customization/check_network_config.yml index 7adb61735..5625697e4 100644 --- a/linux/guest_customization/check_network_config.yml +++ b/linux/guest_customization/check_network_config.yml @@ -126,12 +126,12 @@ - name: "Set traditional GOSC network configuration file on Ubuntu {{ guest_os_ansible_distribution_ver }}" ansible.builtin.set_fact: src_network_file: "/etc/netplan/99-netcfg-vmware.yaml" - when: "gosc_workflow == 'perl'" + when: not enable_cloudinit_gosc - name: "Set cloud-init GOSC network configuration file on Ubuntu {{ guest_os_ansible_distribution_ver }}" ansible.builtin.set_fact: src_network_file: "/etc/netplan/50-cloud-init.yaml" - when: "gosc_workflow == 'cloud-init'" + when: enable_cloudinit_gosc # On Debian 10/11 or Ubuntu Desktop eariler than 19.10, the network configure file is # /etc/network/interfaces @@ -145,10 +145,10 @@ - name: "Set traditional GOSC network configuration file on {{ vm_guest_os_distribution }}" ansible.builtin.set_fact: src_network_file: "/etc/network/interfaces" - when: "gosc_workflow == 'perl'" + when: not enable_cloudinit_gosc - name: "Set cloud-init GOSC network configuration file on {{ vm_guest_os_distribution }}" - when: "gosc_workflow == 'cloud-init'" + when: enable_cloudinit_gosc block: - name: "Set cloud-init GOSC network configuration file on {{ vm_guest_os_distribution }}" ansible.builtin.set_fact: diff --git a/linux/guest_customization/check_timezone_and_hwclock.yml b/linux/guest_customization/check_timezone_and_hwclock.yml index 109eab585..abcd6d377 100644 --- a/linux/guest_customization/check_timezone_and_hwclock.yml +++ b/linux/guest_customization/check_timezone_and_hwclock.yml @@ -10,54 +10,62 @@ ansible.builtin.set_fact: guest_hwclockUTC: "" hwclock_success: "" - when: gosc_workflow == "perl" + when: not enable_cloudinit_gosc -# Try to get timezone info by 'timedatectl' command -- include_tasks: ../../common/vm_shell_in_guest.yml +# Try to get timedatectl status +- name: "Get the result of 'timedatectl status'" + include_tasks: ../../common/vm_shell_in_guest.yml vars: vm_shell_cmd: "/usr/bin/timedatectl" vm_shell_args: "status" vm_shell_out: "/tmp/timedatectl_status.txt" -# If 'timedatectl' command succeed -- block: - - include_tasks: ../../common/vm_guest_file_operation.yml +- name: "Get timezone and hardware clock when 'timedatectl status' succeeded" + when: + - vm_shell_result.exit_code is defined + - vm_shell_result.exit_code == 0 + block: + - name: "Fetch the output file of 'timedatectl status'" + include_tasks: ../../common/vm_guest_file_operation.yml vars: operation: "fetch_file" src_path: "/tmp/timedatectl_status.txt" dest_path: "{{ current_test_log_folder }}/timedatectl_status.txt" - - name: "Get time zone from 'timedatectl status'" + - name: "Get timezone from 'timedatectl status'" ansible.builtin.set_fact: guest_timedate_status: "{{ lookup('file', current_test_log_folder ~ '/timedatectl_status.txt') | regex_search('\\s*Time zone:\\s*[^\\n]+\\n?') }}" - - name: "Set fact of guest time zone after GOSC" + - name: "Set fact of guest timezone after GOSC" ansible.builtin.set_fact: guest_timezone: "{{ guest_timedate_status | regex_replace('.*\\s*Time zone:\\s*([^\\s]+)\\s*.*\\n?', '\\1')}}" - - block: - - name: "Get hwclock from 'timedatectl status'" + - name: "Get hardware clock from 'timedatectl status'" + when: not enable_cloudinit_gosc + block: + - name: "Get hardware clock from 'timedatectl status'" include_tasks: ../utils/file_content_search.yml vars: path: "{{ current_test_log_folder }}/timedatectl_status.txt" regexp: "^ *RTC in local TZ: no" register: hwclock_result + - name: "Save guest hardware clock setting after GOSC" ansible.builtin.set_fact: guest_hwclockUTC: "{{ regexp_found | int > 0 }}" - when: (gosc_workflow == "perl") - when: vm_shell_result.exit_code is defined and vm_shell_result.exit_code == 0 -# If 'timedatectl' command failed -# Get timezone by reading symbolic link of /etc/localtime -- block: - - include_tasks: ../../common/vm_shell_in_guest.yml +- name: "Get timezone and hardware clock when 'timedatectl status' command failed" + when: vm_shell_result.exit_code is undefined or vm_shell_result.exit_code != 0 + block: + - name: "Read the symbolic link of /etc/localtime" + include_tasks: ../../common/vm_shell_in_guest.yml vars: vm_shell_cmd: "/usr/bin/readlink" vm_shell_args: "/etc/localtime" vm_shell_out: "/tmp/readlink_etc_localtime.txt" - - include_tasks: ../../common/vm_guest_file_operation.yml + - name: "Fetch the real file of /etc/localtime" + include_tasks: ../../common/vm_guest_file_operation.yml vars: operation: "fetch_file" src_path: "/tmp/readlink_etc_localtime.txt" @@ -67,30 +75,34 @@ ansible.builtin.set_fact: guest_timezone: "{{ lookup('file', current_test_log_folder ~ '/readlink_etc_localtime.txt') | replace('/usr/share/zoneinfo/','') }}" - # Get hwclock by running command "hwclock -D" when test perl GOSC - - block: - - include_tasks: ../../common/vm_shell_in_guest.yml + - name: "Get hardware clock by running command 'hwclock -D' for perl GOSC" + when: not enable_cloudinit_gosc + block: + - name: "Execute command 'hwclock -D'" + include_tasks: ../../common/vm_shell_in_guest.yml vars: vm_shell_cmd: "/usr/sbin/hwclock" vm_shell_args: "-D" vm_shell_out: "/tmp/hwclock_D.txt" - - include_tasks: ../../common/vm_guest_file_operation.yml + + - name: "Fetch the output file of 'hwclock -D'" + include_tasks: ../../common/vm_guest_file_operation.yml vars: operation: "fetch_file" src_path: "/tmp/hwclock_D.txt" dest_path: "{{ current_test_log_folder }}/hwclock_D.txt" - - name: "Get hwclock from 'hwclock -D'" + + - name: "Get hardware clock from the output of 'hwclock -D'" include_tasks: ../utils/file_content_search.yml vars: path: "{{ current_test_log_folder }}/hwclock_D.txt" regexp: "^Hardware clock is on UTC time" + - name: "Save hardware clock settting after GOSC" ansible.builtin.set_fact: guest_hwclockUTC: "{{ regexp_found | int > 0 }}" - when: gosc_workflow == "perl" - when: vm_shell_result.exit_code is undefined or vm_shell_result.exit_code != 0 -# Check guest time zone +# Check guest timezone - name: "Check guest timezone is customized" ansible.builtin.set_fact: timezone_success: "{{ guest_timezone == linux_gosc_spec['timezone'] }}" @@ -98,22 +110,26 @@ - name: "Print timezone check result" ansible.builtin.debug: var=timezone_success -- include_tasks: set_gosc_validation_result.yml +- name: "Set validation result for customizing timezone" + include_tasks: set_gosc_validation_result.yml vars: gosc_check_item: "timezone_success" gosc_check_error_msg: "VM timezone is {{ guest_timezone }}, expected timezone is {{ linux_gosc_spec['timezone'] }}" # Check guest hwclock # cloud-init GOSC doesn't support hwclock customization -- block: - - name: Check guest hwclock is customized +- name: "Check guest hardware clock is customized" + when: not enable_cloudinit_gosc + block: + - name: "Check guest hardware clock is customized" ansible.builtin.set_fact: hwclock_success: "{{ guest_hwclockUTC == linux_gosc_spec['hwclockUTC'] }}" + - name: "Print hardware clock check result" ansible.builtin.debug: var=hwclock_success - - include_tasks: set_gosc_validation_result.yml + - name: "Set validation result for customizing hardware clock" + include_tasks: set_gosc_validation_result.yml vars: gosc_check_item: "hwclock_success" gosc_check_error_msg: "VM hwclockUTC is {{ guest_hwclockUTC }}, expected hwclockUTC is {{ linux_gosc_spec['hwclockUTC'] }}" - when: gosc_workflow == "perl" diff --git a/linux/guest_customization/gosc_support_matrix.yml b/linux/guest_customization/gosc_support_matrix.yml index cc335bb2e..2fa0353a9 100644 --- a/linux/guest_customization/gosc_support_matrix.yml +++ b/linux/guest_customization/gosc_support_matrix.yml @@ -2,19 +2,29 @@ # SPDX-License-Identifier: BSD-2-Clause --- # This file listed guest OS customization(GOSC) testing supported OS start versions, vCenter Server versions and builds and depended open-vm-tools versions. OS releases listed in this file are supported by ansible-vsphere-gos-validation for GOSC testing. For all OS releases supported guest OS customization on vSphere, please see https://partnerweb.vmware.com/programs/guestOS/guest-os-customization-matrix.pdf. -# See https://kb.vmware.com/s/article/2143838 for build numbers and versions of VMware vCenter Server. +# See https://knowledge.broadcom.com/external/article?legacyId=2143838 for build numbers and versions of VMware vCenter Server. # Note: All build numbers listed below are the build numbers of Client/MOB/vpxd.log. -# SLES 15.3 and higher version supports GOSC testing on vCenter Server 6.7.0 from build 14368073, or higher vCenter Server versions. -SLES: - '15.3': +# RHEL family OS 9.x supports GOSC testing on vCenter Server 6.7.0 from build 19832280, and on vCenter Server 7.0.3 from build 20051473, or higher vCenter Server versions. +# RHEL family OS 10.x (including CentOS Stream 10) supports GOSC testing on vCenter Server 8.0.3 from build 24022515 (with workaround), or higher vCenter Server versions (without workarounds). +# See https://knowledge.broadcom.com/external/article?legacyId=88199. +RedHat: + '9': vcenter: - 6.7.0: 14368073 + 6.7.0: 19832280 + 7.0.0: N/A + 7.0.1: N/A + 7.0.2: N/A + 7.0.3: 20051473 + '10': + vcenter: + 8.0.3: 24022515 +# # 1. Rocky 8.4 and higher version supports GOSC testing on vCenter Server 6.7.0 from build 18831049, and on vCenter Server 7.0.3 from build 18700403, or higher vCenter Server versions; not supports GOSC testing for all of builds on 7.0.0/7.0.1/7.0.2. -# See https://kb.vmware.com/s/article/86163. -# 2. Rocky 9.x supports GOSC testing on vCenter Server 6.7.0 from build 19832280, and on vCenter Server 7.0.3 from build 20051473, or higher vCenter Server versions; not supports GOSC testing for all of builds on 7.0.0/7.0.1/7.0.2. -# See https://kb.vmware.com/s/article/86163 and https://kb.vmware.com/s/article/88199. +# See https://knowledge.broadcom.com/external/article?legacyId=86163. +# 2. Rocky 9.0 and higher version GOSC supporting status aligns with RHEL 9.x. +# See https://knowledge.broadcom.com/external/article?legacyId=86163 and https://knowledge.broadcom.com/external/article?legacyId=88199. Rocky: '8.4': vcenter: @@ -23,18 +33,11 @@ Rocky: 7.0.1: N/A 7.0.2: N/A 7.0.3: 18700403 - '9.0': - vcenter: - 6.7.0: 19832280 - 7.0.0: N/A - 7.0.1: N/A - 7.0.2: N/A - 7.0.3: 20051473 # 1. AlmaLinux 8.4 and higher version supports GOSC testing on vCenter Server 6.7.0 from build 18831049, and on vCenter Server 7.0.3 from build 19480866, or higher vCenter Server versions; not supports GOSC testing for all of builds on 7.0.0/7.0.1/7.0.2. -# See https://kb.vmware.com/s/article/85686. -# 2. AlmaLinux 9.x supports GOSC testing on vCenter Server 6.7.0 from build 19832280, and on vCenter Server 7.0.3 from build 20051473, or higher vCenter Server versions; not supports GOSC testing for all of builds on 7.0.0/7.0.1/7.0.2. -# See https://kb.vmware.com/s/article/85686 and https://kb.vmware.com/s/article/88199. +# See https://knowledge.broadcom.com/external/article?legacyId=85686. +# 2. AlmaLinux 9.0 and higher version GOSC supporting status aligns with RHEL 9.x. +# See https://knowledge.broadcom.com/external/article?legacyId=85686 and https://knowledge.broadcom.com/external/article?legacyId=88199. AlmaLinux: '8.4': vcenter: @@ -43,28 +46,27 @@ AlmaLinux: 7.0.1: N/A 7.0.2: N/A 7.0.3: 19480866 - '9.0': + +# SLES 15.3 and higher version supports GOSC testing on vCenter Server 6.7.0 from build 14368073, or higher vCenter Server versions. +SLES: + '15.3': vcenter: - 6.7.0: 19832280 - 7.0.0: N/A - 7.0.1: N/A - 7.0.2: N/A - 7.0.3: 20051473 + 6.7.0: 14368073 # Debian 10.10 and higher version supports GOSC on vCenter Server 8.0.0 GA release or later (from build 20519528). -# See https://kb.vmware.com/s/article/85845. +# See https://knowledge.broadcom.com/external/article?legacyId=85845. Debian: '10.10': vcenter: 8.0.0: 20519528 # 1. Ubuntu 18.04 supports GOSC testing on vCenter Server 6.7.0 from build 14368073, or higher vCenter Server versions, -# and requires open-vm-tools 10.3.10 or higher versions. See https://kb.vmware.com/s/article/56409. +# and requires open-vm-tools 10.3.10 or higher versions. See https://knowledge.broadcom.com/external/article?legacyId=56409. # 2. Ubuntu 20.04 supports GOSC testing on vCenter Server 6.7.0 from build 16046713, or higher vCenter Server versions. # 3. Ubuntu 20.10 supports GOSC testing on vCenter Server 7.0.0 from build 15952599, or higher vCenter Server versions. -# See https://kb.vmware.com/s/article/80934. +# See https://knowledge.broadcom.com/external/article?legacyId=80934. # 4. Ubuntu 21.04 and higher version supports GOSC testing on vCenter Server 7.0.1 from build 16858589, or higher vCenter Server versions. -# See https://kb.vmware.com/s/article/59687 and https://kb.vmware.com/s/article/80934. +# See https://knowledge.broadcom.com/external/article?legacyId=59687 and https://knowledge.broadcom.com/external/article?legacyId=80934. Ubuntu: '18.04': vcenter: @@ -80,28 +82,6 @@ Ubuntu: vcenter: 7.0.1: 16858589 -# RHEL 9.x supports GOSC testing on vCenter Server 6.7.0 from build 19832280, and on vCenter Server 7.0.3 from build 20051473, or higher vCenter Server versions. -# See https://kb.vmware.com/s/article/80934. -RedHat: - '9.0': - vcenter: - 6.7.0: 19832280 - 7.0.0: N/A - 7.0.1: N/A - 7.0.2: N/A - 7.0.3: 20051473 - -# OracleLinux 9.x supports GOSC testing on vCenter Server 6.7.0 from build 19832280, and on vCenter Server 7.0.3 from build 20051473, or higher vCenter Server versions. -# See https://kb.vmware.com/s/article/80934. -OracleLinux: - '9.0': - vcenter: - 6.7.0: 19832280 - 7.0.0: N/A - 7.0.1: N/A - 7.0.2: N/A - 7.0.3: 20051473 - # Pardus 21.x / 23.x support GOSC testing on vCenter Server 8.0U2 and on vCenter Server 7.0.3 from build 22585855(7.0.3P08), or higher vCenter Server versions. Pardus GNU/Linux: '21.2': @@ -117,11 +97,11 @@ Pardus GNU/Linux: 8.0.1: N/A 8.0.2: 22385739 -# Miracle Linux 8.4 and later, 9.0 support GOSC testing on vCenter Server 8.0U3. +# Miracle Linux 8.4 and higher version support GOSC testing on vCenter Server 8.0.3 from build 24022515, or higher vCenter Server versions. MIRACLE: '8.4': vcenter: - 8.0.2: N/A - '9.2': + 8.0.3: 24022515 + '9': vcenter: - 8.0.2: N/A + 8.0.3: 24022515 diff --git a/linux/guest_customization/handle_gosc_known_issues.yml b/linux/guest_customization/handle_gosc_known_issues.yml new file mode 100644 index 000000000..f39975eb4 --- /dev/null +++ b/linux/guest_customization/handle_gosc_known_issues.yml @@ -0,0 +1,106 @@ +# Copyright 2024 VMware, Inc. +# SPDX-License-Identifier: BSD-2-Clause +--- +# Handle guest customization known issues with workarounds +# +- name: "Handle Perl GOSC known issues" + when: not enable_cloudinit_gosc + block: + # Perl GOSC fails on CentOS/RHEL 10 or their varieties on vCenter Server 8.0.3 because + # /etc/sysconfig/network-scripts doesn't exist. + - name: "Handle known issue for {{ vm_guest_os_distribution }} on vCenter Server {{ vcenter_version }}" + when: + - vcenter_version is version('8.0.3', '==') + - guest_os_family == "RedHat" + - guest_os_network_manager == "NetworkManager" + block: + - name: "Set fact of traditional network scripts directory" + ansible.builtin.set_fact: + guest_sysconfig_network_dir: "/etc/sysconfig/network-scripts" + + - name: "Check whether {{ guest_sysconfig_network_dir }} exists" + include_tasks: ../utils/get_file_stat_info.yml + vars: + guest_file_path: "{{ guest_sysconfig_network_dir }}" + + - name: "Add Perl GOSC workaround for {{ vm_guest_os_distribution }} on vCenter Server {{ vcenter_version }}" + when: not guest_file_exists + block: + - name: "Create directory {{ guest_sysconfig_network_dir }} on {{ vm_guest_os_distribution }}" + ansible.builtin.shell: "mkdir -p {{ guest_sysconfig_network_dir }}" + delegate_to: "{{ vm_guest_ip }}" + + - name: "Known issue - Perl GOSC of {{ vm_guest_os_distribution }} on vCenter Server {{ vcenter_version }}" + ansible.builtin.debug: + msg: + - "Perl guest customization would fail due to not found {{ guest_sysconfig_network_dir }} on {{ vm_guest_os_distribution }}." + - "Please refer to https://issues.redhat.com/browse/RHEL-40365." + - "Created directory {{ guest_sysconfig_network_dir }} as a workaround." + tags: + - known_issue + + # Perl GOSC fails on Ubuntu 23.10 or later versions due to hwclock not built-in + - name: "Handle known issue for {{ vm_guest_os_distribution }} on vCenter Server {{ vcenter_version }}" + when: + - vcenter_version is version('8.0.3', '<') + - guest_os_ansible_distribution == "Ubuntu" + - guest_os_ansible_distribution_ver is version('23.10', '>=') + block: + - name: "Check whether 'hwclock' exists" + ansible.builtin.shell: "which hwclock" + delegate_to: "{{ vm_guest_ip }}" + register: check_hwclock_result + ignore_errors: true + + - name: "Handle known issue for {{ vm_guest_os_distribution }} without 'hwclock'" + when: check_hwclock_result.rc is undefined or check_hwclock_result.rc != 0 + block: + - name: "Install 'hwclock' package 'util-linux-extra'" + include_tasks: ../utils/install_uninstall_package.yml + vars: + package_list: ["util-linux-extra"] + package_state: "present" + + - name: "Known issue - Perl GOSC of {{ vm_guest_os_distribution }} on vCenter Server {{ vcenter_version }}" + ansible.builtin.debug: + msg: + - "Perl guest customization would fail due to path to hwclock not found" + - "Please refer to https://knowledge.broadcom.com/external/article?legacyId=95091" + - "Installed package 'util-linux-extra' as a workaround" + tags: + - known_issue + +# Cloud-init GOSC failure on Oracle Linux 8.7 and 9.1 +- name: "Handle known issue for {{ vm_guest_os_distribution }} on vCenter Server {{ vcenter_version }}" + when: + - enable_cloudinit_gosc + - guest_os_ansible_distribution == "OracleLinux" + - guest_os_ansible_distribution_ver in ['8.7', '9.1'] + block: + - name: "Uninstall current cloud-init" + include_tasks: ../utils/install_uninstall_package.yml + vars: + package_list: ["cloud-init"] + package_state: "absent" + + - name: "Remove /etc/cloud dir before install the latest cloud-init" + ansible.builtin.shell: | + if [ -e "/etc/cloud" ] ; then + rm -rf "/etc/cloud"; + fi + delegate_to: "{{ vm_guest_ip }}" + + - name: "Install latest cloud-init version" + include_tasks: ../utils/install_uninstall_package.yml + vars: + package_list: ["cloud-init"] + package_state: "latest" + + - name: "Known issue - failure of cloud-init GOSC in Oracle Linux 8.7 and 9.1" + ansible.builtin.debug: + msg: + - "Cloud-init guest customization would fail because cloud-init-local.service couldn't start when using cloud-init 22.1-5.0.1." + - "The issue has been resolved in cloud-init 22.1-6.0.1. Upgraded cloud-init to latest version as a workaround." + - "Please refer to https://bugzilla.oracle.com/bugzilla/show_bug.cgi?id=18115 for details." + tags: + - known_issue diff --git a/linux/guest_customization/linux_gosc_start.yml b/linux/guest_customization/linux_gosc_start.yml index 741b88fa8..0b79e08ad 100644 --- a/linux/guest_customization/linux_gosc_start.yml +++ b/linux/guest_customization/linux_gosc_start.yml @@ -64,7 +64,7 @@ seconds: 30 when: - guest_os_ansible_distribution != "VMware Photon OS" - - not enable_cloudinit_gosc | bool + - not enable_cloudinit_gosc - gosc_state_keyword_found is defined - gosc_state_keyword_found | bool @@ -85,7 +85,7 @@ vars: wait_gosc_log_file: "{{ gosc_deploypkg_log_file }}" wait_gosc_msg_regexp: "Ran DeployPkg_DeployPackageFromFile successfully" - when: not enable_cloudinit_gosc | bool + when: not enable_cloudinit_gosc - name: "Wait for cloud-init GOSC complete message" block: @@ -102,4 +102,4 @@ wait_gosc_log_file: "{{ gosc_cloudinit_log_file }}" wait_gosc_msg_regexp: "Cloud-init .*finished at.*Datasource DataSourceVMware \\[seed=imc\\]" when: cloudinit_version is version('23.1', '>=') - when: enable_cloudinit_gosc | bool + when: enable_cloudinit_gosc diff --git a/linux/guest_customization/linux_gosc_workflow.yml b/linux/guest_customization/linux_gosc_workflow.yml index 680cb3953..5a61f0cf7 100644 --- a/linux/guest_customization/linux_gosc_workflow.yml +++ b/linux/guest_customization/linux_gosc_workflow.yml @@ -11,7 +11,7 @@ block: - name: "Set cloud-init workflow flag" ansible.builtin.set_fact: - enable_cloudinit_gosc: "{% if gosc_workflow == 'cloud-init' %}True{% else %}False{% endif %}" + enable_cloudinit_gosc: "{{ gosc_workflow == 'cloud-init' }}" - name: "Test setup" include_tasks: ../setup/test_setup.yml @@ -43,7 +43,7 @@ package_list: ["open-vm-tools-gosc-{{ vmtools_version }}"] package_state: "present" when: - - not enable_cloudinit_gosc | bool + - not enable_cloudinit_gosc - guest_os_ansible_distribution_major_ver | int >= 4 - vmtools_version is defined - vmtools_version is version('11.3.5', '>=') @@ -51,7 +51,7 @@ # Install perl if guest OS doesn't have it - name: "Prepare for perl GOSC testing on {{ guest_os_ansible_distribution }}" when: - - not enable_cloudinit_gosc | bool + - not enable_cloudinit_gosc - guest_os_family == "RedHat" block: - name: "Check perl existence" @@ -75,6 +75,13 @@ package_list: ["{{ guest_perl_package_name }}"] package_state: "latest" + - name: "Get guest OS network manager" + include_tasks: ../utils/get_network_manager.yml + when: guest_os_network_manager is undefined + + - name: "Handle known issues with workarounds" + include_tasks: handle_gosc_known_issues.yml + - name: "Prepare for cloud-init GOSC" when: enable_cloudinit_gosc block: @@ -85,46 +92,12 @@ package_state: "present" when: guest_os_ansible_distribution != "VMware Photon OS" - # Need to install the latest cloud-init to Oracle Linux 8.7, 9.1 and pass the GOSC tests in Ansible - - name: "Update cloud-init GOSC in OracleLinux 8.7 & 9.1" - when: - - guest_os_ansible_distribution == "OracleLinux" - - guest_os_ansible_distribution_ver in ['8.7', '9.1'] - block: - - name: "Known issue - failure of cloud-init GOSC in Oracle Linux 8.7 and 9.1" - ansible.builtin.debug: - msg: - - "Cloud-init guest customization would fail because cloud-init-local.service couldn't start when using cloud-init 22.1-5.0.1." - - "The issue has been resolved in cloud-init 22.1-6.0.1. Here will upgrade cloud-init to latest version for resolution." - - "Please refer to https://bugzilla.oracle.com/bugzilla/show_bug.cgi?id=18115 for details." - tags: - - known_issue - - - name: "Uninstall current cloud-init" - include_tasks: ../utils/install_uninstall_package.yml - vars: - package_list: ["cloud-init"] - package_state: "absent" - - - name: "Remove /etc/cloud dir before install the latest cloud-init" - ansible.builtin.shell: | - if [ -e "/etc/cloud" ] ; then - rm -rf "/etc/cloud"; - fi - delegate_to: "{{ vm_guest_ip }}" - - - name: "Install latest cloud-init version" - include_tasks: ../utils/install_uninstall_package.yml - vars: - package_list: ["cloud-init"] - package_state: "latest" - # Check whether cloud-init version meets cloud-init GOSC requirements # Debian 10 and 11 cloud-init GOSC requires cloud-init 22.1 or later installed. # See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1008039 # For Miracle Linux 8.x and 9.x, cloud-init GOSC requires cloud-init 22.1 or later installed. # For other Linux, cloud-init GOSC requires cloud-init 18.5 or later installed. - # See https://kb.vmware.com/s/article/90331 + # See https://knowledge.broadcom.com/external/article?legacyId=90331 - name: "Set fact of cloud-init version for supporting GOSC" ansible.builtin.set_fact: gosc_required_cloudinit_version: >- @@ -144,10 +117,6 @@ (not cloudinit_version) or not (cloudinit_version is version(gosc_required_cloudinit_version, '>=')) - - name: "Get guest OS network manager" - include_tasks: ../utils/get_network_manager.yml - when: guest_os_network_manager is undefined - - name: "Get DNS server info before GOSC" include_tasks: ../utils/get_system_dns.yml @@ -232,5 +201,5 @@ - name: "Colect cloud-init logs" include_tasks: ../utils/collect_cloudinit_logs.yml when: > - (gosc_workflow == "cloud-init") or + enable_cloudinit_gosc or (guest_os_ansible_distribution == "VMware Photon OS")