The task to enable the VirtualMachinePlatform feature on a Windows system fails with the error message: "The role, role service, or feature name is not valid: 'VirtualMachinePlatform'. The name was not found." However, running the Get-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform command shows that the feature is available and enabled on the system.
- name: Enable features for WSL
win_feature:
name: "{{ item }}"
state: present
loop:
- Microsoft-Windows-Subsystem-Linux
- VirtualMachinePlatform
EXPECTED RESULTS
The VirtualMachinePlatform feature should be installed without errors.
ACTUAL RESULTS
The task to install the VirtualMachinePlatform feature fails with the message:
failed: [xxxxxxx] (item=VirtualMachinePlatform) => changed=false
ansible_loop_var: item
item: VirtualMachinePlatform
msg: 'Failed to install Windows Feature: ArgumentNotValid: The role, role service, or feature name is not valid: ''VirtualMachinePlatform''. The name was not found.'
However, running the following PowerShell command shows that the feature is available and enabled:
Get-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
FeatureName : VirtualMachinePlatform
DisplayName : Virtual Machine Platform
Description : Enables platform support for virtual machines
RestartRequired : Possible
State : Enabled
CustomProperties :
SUMMARY
The task to enable the
VirtualMachinePlatform
feature on a Windows system fails with the error message: "The role, role service, or feature name is not valid: 'VirtualMachinePlatform'. The name was not found." However, running theGet-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
command shows that the feature is available and enabled on the system.ISSUE TYPE
COMPONENT NAME
win_feature
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
The
VirtualMachinePlatform
feature should be installed without errors.ACTUAL RESULTS
The task to install the
VirtualMachinePlatform
feature fails with the message:However, running the following PowerShell command shows that the feature is available and enabled: