community.windows icon indicating copy to clipboard operation
community.windows copied to clipboard

win_product_facts returning list instead of string

Open Yannik opened this issue 2 years ago • 0 comments

SUMMARY

As far as my understanding goes, win_product_facts should provide information about the windows operating system licensing status. This is further supported by the logic to retrieve the product key, which only results in one product key, the one of the windows operating system. Finally, the returned facts description also indicates that ansible_os_license_edition, ansible_os_license_status and ansible_os_license_channel should contain a string regarding the windows operating system licensing state.

However, I have noticed that when microsoft office is installed, win_product_facts actually sets ansible_os_license_edition, ansible_os_license_status and ansible_os_license_channel to an array which contains information about both windows and ms office.

Using the examples from the module page:

TASK [windows-activation : Display Windows edition] ************************************************
ok: [myhost] => 
  ansible_os_license_edition:
  - Windows(R), Professional edition
  - Office 16, Office16StandardVL_KMS_Client edition

TASK [windows-activation : Display Windows license status] *****************************************
ok: [myhost] => 
  ansible_os_license_status:
  - Licensed
  - Licensed

The reason for this is the Get-CimInstance SoftwareLicensingProduct | Where-Object PartialProductKey command, which can return more than one result. It would be sensible to append a Where-Object Name -match Windows filter.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_product_facts

Yannik avatar Nov 10 '23 15:11 Yannik