win_feature – Installs and uninstalls Windows Features on Windows Server¶
New in version 1.7.
Synopsis¶
- Installs or uninstalls Windows Roles or Features on Windows Server. This module uses the Add/Remove-WindowsFeature Cmdlets on Windows 2008 R2 and Install/Uninstall-WindowsFeature Cmdlets on Windows 2012, which are not available on client os machines.
Parameters¶
Parameter | Choices/Defaults | Comments |
---|---|---|
include_management_tools
boolean
|
|
Adds the corresponding management tools to the specified feature.
Not supported in Windows 2008 R2 and will be ignored.
|
include_sub_features
boolean
|
|
Adds all subfeatures of the specified feature.
|
name
list
/ required
|
Names of roles or features to install as a single feature or a comma-separated list of features.
|
|
source
-
added in 2.1 |
Specify a source to install the feature from.
Not supported in Windows 2008 R2 and will be ignored.
Can either be
{driveletter}:\sources\sxs or \\{IP}\share\sources\sxs . |
|
state
-
|
|
State of the features or roles on the system.
|
Examples¶
- name: Install IIS (Web-Server only)
win_feature:
name: Web-Server
state: present
- name: Install IIS (Web-Server and Web-Common-Http)
win_feature:
name:
- Web-Server
- Web-Common-Http
state: present
- name: Install NET-Framework-Core from file
win_feature:
name: NET-Framework-Core
source: C:\Temp\iso\sources\sxs
state: present
- name: Install IIS Web-Server with sub features and management tools
win_feature:
name: Web-Server
state: present
include_sub_features: yes
include_management_tools: yes
register: win_feature
- name: reboot if installing Web-Server feature requires it
win_reboot:
when: win_feature.reboot_required
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description | |
---|---|---|---|
exitcode
string
|
always |
The stringified exit code from the feature installation/removal command
Sample:
Success
|
|
feature_result
complex
|
success |
List of features that were installed or removed
|
|
display_name
string
|
always |
Feature display name
Sample:
Telnet Client
|
|
id
integer
|
always |
A list of KB article IDs that apply to the update
Sample:
44
|
|
message
list of strings
|
always |
Any messages returned from the feature subsystem that occurred during installation or removal of this feature
|
|
reboot_required
boolean
|
always |
True when the target server requires a reboot as a result of installing or removing this feature
Sample:
True
|
|
restart_needed
boolean
|
always |
DEPRECATED in Ansible 2.4 (refer to
reboot_required instead). True when the target server requires a reboot as a result of installing or removing this featureSample:
True
|
|
skip_reason
string
|
always |
The reason a feature installation or removal was skipped
Sample:
NotSkipped
|
|
success
boolean
|
always |
If the feature installation or removal was successful
Sample:
True
|
|
reboot_required
boolean
|
success |
True when the target server requires a reboot to complete updates (no further updates can be installed until after a reboot)
Sample:
True
|
|
restart_needed
boolean
|
success |
DEPRECATED in Ansible 2.4 (refer to
reboot_required instead). True when the target server requires a reboot to complete updates (no further updates can be installed until after a reboot)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¶
- Paul Durivage (@angstwad)
- Trond Hindenes (@trondhindenes)
Hint
If you notice any issues in this documentation you can edit this document to improve it.