Documentation

win_feature - Installs and uninstalls Windows Features

New in version 1.7.

Synopsis

Installs or uninstalls Windows Roles or Features

Options

parameter required default choices comments
include_management_tools
no
  • True
  • False
Adds the corresponding management tools to the specified feature
include_sub_features
no
  • True
  • False
Adds all subfeatures of the specified feature
name
yes
    Names of roles or features to install as a single feature or a comma-separated list of features
    restart
    no
    • True
    • False
    Restarts the computer automatically when installation is complete, if restarting is required by the roles or features installed.
    source
    (added in 2.1)
    no
    • {driveletter}:\sources\sxs
    • {IP}\Share\sources\sxs
    Specify a source to install the feature from
    state
    no present
    • present
    • absent
    State of the features or roles on the system

    Examples

    # This installs IIS.
    # The names of features available for install can be run by running the following Powershell Command:
    # PS C:\Users\Administrator> Import-Module ServerManager; Get-WindowsFeature
    $ ansible -i hosts -m win_feature -a "name=Web-Server" all
    $ ansible -i hosts -m win_feature -a "name=Web-Server,Web-Common-Http" all
    ansible -m "win_feature" -a "name=NET-Framework-Core source=C:/Temp/iso/sources/sxs" windows
    
    
    # Playbook example
    ---
    - name: Install IIS
      hosts: all
      gather_facts: false
      tasks:
        - name: Install IIS
          win_feature:
            name: "Web-Server"
            state: present
            restart: yes
            include_sub_features: yes
            include_management_tools: yes
    

    This is a Core Module

    For more information on what this means please read Core Modules

    For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.