microsoft.iis.virtual_directory module – Configures a virtual directory in IIS
Note
This module is part of the microsoft.iis collection (version 1.0.3).
You might already have this collection installed if you are using the ansible package.
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 microsoft.iis.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: microsoft.iis.virtual_directory.
Synopsis
- Creates, removes, and configures a virtual directory in IIS. 
Requirements
The below requirements are needed on the host that executes this module.
- IISAdministration PowerShell module 
Parameters
| Parameter | Comments | 
|---|---|
| The application under which the virtual directory is created or exists. | |
| The type of authentication to use for the virtual directory. Either  If  If  Choices: 
 | |
| The name of the virtual directory to create. | |
| The password associated with  Required when  | |
| The physical path to the folder in which the new virtual directory is created. The specified folder must already exist. This must be set when  | |
| The site name under which the virtual directory should exist. | |
| Whether to add or remove the specified virtual directory. Removing will delete the virtual directory and all its contents recursively. Choices: 
 | |
| Specifies the username of an account that can access configuration files and content for the virtual directory. Required when  | 
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 | 
See Also
See also
- microsoft.iis.virtual_directory_info
- Retrive information on a virtual directory in IIS. 
- microsoft.iis.web_application
- Configures IIS web applications. 
- microsoft.iis.website
- Configures an IIS website. 
Examples
- name: Create a virtual directory
  microsoft.iis.virtual_directory:
    name: somedirectory
    site: somesite
    state: present
    physical_path: C:\virtualdirectory\some
- name: Remove a virtual directory
  microsoft.iis.virtual_directory:
    name: somedirectory
    site: somesite
    state: absent
- name: Create a virtual directory on an application
  microsoft.iis.virtual_directory:
    name: somedirectory
    site: somesite
    application: someapp
    state: present
    physical_path: C:\virtualdirectory\some
