ansible.windows.win_feature – Installs and uninstalls Windows Features on Windows Server¶
This plugin is part of the ansible.windows collection (version 1.7.2).
To install it use:
ansible-galaxy collection install ansible.windows.
To use it in a playbook, specify:
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.
- name: Install IIS (Web-Server only) ansible.windows.win_feature: name: Web-Server state: present - name: Install IIS (Web-Server and Web-Common-Http) ansible.windows.win_feature: name: - Web-Server - Web-Common-Http state: present - name: Install NET-Framework-Core from file ansible.windows.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 ansible.windows.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 ansible.windows.win_reboot: when: win_feature.reboot_required
Common return values are documented here, the following are the fields unique to this module: