ansible.windows.win_capability module – Manage Windows capabilities
Note
This module is part of the ansible.windows collection (version 3.5.0).
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install ansible.windows.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: ansible.windows.win_capability.
New in ansible.windows 3.6.0
Synopsis
Add or remove Windows capabilities from a Windows target.
A Windows capability is an optional feature that can be added to Windows.
Requirements
The below requirements are needed on the host that executes this module.
Windows Server 2019/Windows 10 build 1809 or newer for PowerShell 5.1
Windows Server 2022/Windows 10 build 1903 or newer for PowerShell 7.x
Parameters
Parameter |
Comments |
|---|---|
If Choices:
|
|
Sets the maximum output level for DISM logging.
This log is managed by DISM itself, the values allowed may change with different versions of Windows. |
|
Specifies the full path and file name to log to. If not specified the logging uses the default DISM log file location which is |
|
A list of capability names to add or remove. Supports wildcard patterns like |
|
Use the specified locations as capability sources. |
|
Whether the capability should be present or absent. If If Choices:
|
Attributes
Attribute |
Support |
Description |
|---|---|---|
Support: full |
Can run in check_mode and return changed status prediction without modifying target, if not supported the action will be skipped. |
|
Support: none |
Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode |
|
Platform: windows |
Target OS/families that can be operated against |
Notes
Note
Adding a capability requires the target user to have the
SeBatchLogonRightuser right. Use ansible.windows.win_user_right to manage this user right.This module does not support Server 2016.
See Also
See also
- ansible.windows.win_capability_info
Get information about Windows capabilities.
Examples
- name: Install OpenSSH Client capability using short name
ansible.windows.win_capability:
name: OpenSSH.Client
state: present
- name: Install OpenSSH Client capability using full name
ansible.windows.win_capability:
name: OpenSSH.Client~~~~0.0.1.0
state: present
- name: Install both OpenSSH Client and OpenSSH Server capabilities using list
ansible.windows.win_capability:
name:
- OpenSSH.Client
- OpenSSH.Server
state: present
- name: Install both OpenSSH Client and OpenSSH Server capabilities using wildcard pattern
ansible.windows.win_capability:
name: OpenSSH.*
state: present
- name: Remove OpenSSH Client capability
ansible.windows.win_capability:
name: OpenSSH.Client
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
A list of capabilities that were added or removed. Returned: always |
|
Whether a reboot is required to complete the operation. Returned: always |