Join AnsibleFest at Red Hat Summit!

microsoft.iis.virtual_directory module – Configures a virtual directory in IIS

Note

This module is part of the microsoft.iis collection (version 1.0.2).

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

application

string

The application under which the virtual directory is created or exists.

connect_as

string

The type of authentication to use for the virtual directory. Either pass_through or specific_user.

If pass_through, IIS uses the identity of the user or application pool identity to access the physical path.

If specific_user, IIS uses the credentials provided in username and password to access the physical path.

Choices:

  • "pass_through"

  • "specific_user"

name

string / required

The name of the virtual directory to create.

password

string

The password associated with username.

Required when connect_as=specific_user.

physical_path

string

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 state=present and the virtual directory does not already exist.

site

string / required

The site name under which the virtual directory should exist.

state

string

Whether to add or remove the specified virtual directory.

Removing will delete the virtual directory and all its contents recursively.

Choices:

  • "absent"

  • "present" ← (default)

username

string

Specifies the username of an account that can access configuration files and content for the virtual directory.

Required when connect_as=specific_user.

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying target, if not supported the action will be skipped.

diff_mode

Support: none

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode

platform

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

Authors

  • Hen Yaish (@hyaish)