Skip to content

Commit 43d1dde

Browse files
committed
add OS CPU arch info
Signed-off-by: dw035535 <diane.wang@broadcom.com>
1 parent 019d189 commit 43d1dde

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

common/get_guest_system_info.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
vars:
2222
gos_info_filter:
2323
- 'ansible_architecture'
24+
- 'ansible_architecture2'
2425
- 'ansible_distribution*'
2526
- 'ansible_kernel'
2627
- 'ansible_os_family'
@@ -36,6 +37,7 @@
3637
guest_os_ansible_distribution: "{{ guest_system_info.ansible_distribution | default('') }}"
3738
guest_os_ansible_system: "{{ guest_system_info.ansible_system | default('') | lower }}"
3839
guest_os_ansible_architecture: "{{ guest_system_info.ansible_architecture | default('') }}"
40+
guest_os_ansible_architecture2: "{{ guest_system_info.ansible_architecture2 | default('') }}"
3941
guest_os_ansible_distribution_ver: "{{ guest_system_info.ansible_distribution_version if guest_system_info.ansible_distribution != 'FreeBSD' else guest_system_info.ansible_kernel }}"
4042
guest_os_ansible_distribution_major_ver: "{{ guest_system_info.ansible_distribution_major_version if 'ansible_distribution_major_version' in guest_system_info else guest_system_info.ansible_distribution_release.split('-')[0].split('.')[0] }}"
4143
guest_os_ansible_distribution_minor_ver: |-

windows/check_os_fullname/check_vm_guest_info.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
# Set expected guest ID corresponding to current OS
1515
- name: "Set fact of expected guest ID of current {{ guest_os_ansible_architecture }} OS"
1616
ansible.builtin.set_fact:
17-
current_os_guest_id: "{{ (guest_os_ansible_architecture == '64-bit' | ternary(current_gos_info.win_guest_id | select('match', '.*64Guest'), current_gos_info.win_guest_id | reject('match', '.*64Guest')))[0] }}"
17+
current_os_guest_id: >-
18+
{%- if guest_os_ansible_architecture == '32-bit' -%}{{ (current_gos_info.win_guest_id | reject('match', '.*64Guest'))[0] }}
19+
{%- elif guest_os_ansible_cpu_arch == 'x86' -%}
20+
{%- elif guest_os_ansible_cpu_arch == 'arm' -%}
21+
{%- endif -%}
1822
1923
- name: "Get the previous OS info in the pre-defined guest OS info list"
2024
include_tasks: get_previous_gos_info.yml

windows/utils/get_windows_system_info.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,21 @@
5151
guest_os_ansible_distribution: >-
5252
{{ (guest_os_ansible_distribution | regex_search('Microsoft Windows( Server)? ([0-9]+) (R2 )?')).strip() }}
5353
54+
- name: "Set Windows guest OS CPU architecture"
55+
ansible.builtin.set_fact:
56+
guest_os_ansible_cpu_arch: >-
57+
{%- if guest_os_ansible_architecture2 in ['x86_64', 'amd64', 'i386'] -%}x86
58+
{%- elif guest_os_ansible_architecture2 == 'aarch64'-%}arm
59+
{%- endif -%}
60+
5461
- name: "Print Windows guest OS information"
5562
ansible.builtin.debug:
5663
msg:
5764
- "Guest OS: {{ guest_os_ansible_distribution }}"
5865
- "Guest OS type: {{ guest_os_ansible_system }}"
5966
- "Guest OS arch: {{ guest_os_ansible_architecture }}"
67+
- "Guest OS arch2: {{ guest_os_ansible_architecture2 }}"
68+
- "Guest OS CPU arch: {{ guest_os_ansible_cpu_arch }}"
6069
- "Guest OS major version: {{ guest_os_ansible_distribution_major_ver }}"
6170
- "Guest OS minor version: {{ guest_os_ansible_distribution_minor_ver }}"
6271
- "Guest OS version: {{ guest_os_ansible_distribution_ver }}"

0 commit comments

Comments
 (0)