win_optional_feature – Manage optional Windows features¶
New in version 2.8.
Synopsis¶
Install or uninstall optional Windows features on non-Server Windows.
This module uses the
Enable-WindowsOptionalFeature
andDisable-WindowsOptionalFeature
cmdlets.
Parameters¶
See Also¶
See also
- win_chocolatey – Manage packages using chocolatey
The official documentation on the win_chocolatey module.
- win_feature – Installs and uninstalls Windows Features on Windows Server
The official documentation on the win_feature module.
- win_package – Installs/uninstalls an installable package
The official documentation on the win_package module.
Examples¶
- 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
Return Values¶
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
|
Status¶
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by the Ansible Community. [community]
Authors¶
Carson Anderson (@rcanderson23)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.