ansible.windows.win_optional_feature – Manage optional Windows features¶
Note
This plugin is part of the ansible.windows collection (version 1.4.0).
To install it use: ansible-galaxy collection install ansible.windows
.
To use it in a playbook, specify: ansible.windows.win_optional_feature
.
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
- chocolatey.chocolatey.win_chocolatey
The official documentation on the chocolatey.chocolatey.win_chocolatey module.
- ansible.windows.win_feature
The official documentation on the ansible.windows.win_feature module.
- ansible.windows.win_package
The official documentation on the ansible.windows.win_package module.
Examples¶
- name: Install .Net 3.5
ansible.windows.win_optional_feature:
name: NetFx3
state: present
- name: Install .Net 3.5 from source
ansible.windows.win_optional_feature:
name: NetFx3
source: \\share01\win10\sources\sxs
state: present
- name: Install Microsoft Subsystem for Linux
ansible.windows.win_optional_feature:
name: Microsoft-Windows-Subsystem-Linux
state: present
register: wsl_status
- name: Reboot if installing Linux Subsytem as feature requires it
ansible.windows.win_reboot:
when: wsl_status.reboot_required
- name: Install multiple features in one task
ansible.windows.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
|
Authors¶
Carson Anderson (@rcanderson23)