New in version 2.8.
Enable-WindowsOptionalFeature
and Disable-WindowsOptionalFeature
cmdlets.Parameter | Choices/Defaults | Comments |
---|---|---|
include_parent boolean |
| Whether to enable the parent feature and the parent's dependencies. |
name list / required | The name(s) of the feature to install. This relates to FeatureName in the Powershell cmdlet.To list all available features use the PowerShell command Get-WindowsOptionalFeature . | |
source string | Specify a source to install the feature from. Can either be {driveletter}:\sources\sxs or \\{IP}\share\sources\sxs . | |
state string |
| Whether to ensure the feature is absent or present on the system. |
See also
- name: Install .Net 3.5 win_optional_feature: name: NetFx3 state: present - name: Install .Net 3.5 from source win_optional_feature: name: NetFx3 source: \\share01\win10\sources\sxs state: present - name: Install Microsoft Subsystem for Linux win_optional_feature: name: Microsoft-Windows-Subsystem-Linux state: present register: wsl_status - name: Reboot if installing Linux Subsytem as feature requires it win_reboot: when: wsl_status.reboot_required - name: Install multiple features in one task win_optional_feature: name: - NetFx3 - Microsoft-Windows-Subsystem-Linux state: present
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
reboot_required boolean | success | True when the target server requires a reboot to complete updates Sample: True |
Hint
If you notice any issues in this documentation, you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.9/modules/win_optional_feature_module.html