ansible.builtin.win_dsc (v2.4.6.0-1) — module

Invokes a PowerShell DSC configuration

| "added in version" 2.4 of ansible.builtin"

Authors: Trond Hindenes

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.4.6.0.post1

Description

Invokes a PowerShell DSC Configuration. Requires PowerShell version 5 (February release or newer).

Most of the parameters for this module are dynamic and will vary depending on the DSC Resource.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Playbook example
  - name: Extract zip file
    win_dsc:
      resource_name: archive
      ensure: Present
      path: "C:\\Temp\\zipfile.zip"
      destination: "C:\\Temp\\Temp2"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Invoke DSC with check mode
    win_dsc:
      resource_name: windowsfeature
      name: telnet-client

Inputs

    
resource_name:
    description:
    - The DSC Resource to use. Must be accessible to PowerShell using any of the default
      paths.
    required: true

module_version:
    default: latest
    description:
    - Can be used to configure the exact version of the dsc resource to be invoked.
    - Useful if the target node has multiple versions installed of the module containing
      the DSC resource.
    - If not specified, the module will follow standard Powershell convention and use
      the highest version available.

Outputs

attributes:
  contains:
    Key:
      description: Attribute key
    Value:
      description: Attribute value
  description: The attributes/parameters passed in to the DSC resource as key/value
    pairs
  returned: always
  sample: null
  type: complex
dsc_attributes:
  contains:
    Key:
      description: Attribute key
    Value:
      description: Attribute value
  description: The attributes/parameters as returned from the DSC engine in dict format
  returned: always
  type: complex
message:
  description: any error message from invoking the DSC resource
  returned: error
  sample: Multiple DSC modules found with resource name xyz
  type: string
module_version:
  description: The version of the dsc resource/module used.
  returned: success
  sample: 1.0.1
  type: string
reboot_required:
  description: flag returned from the DSC engine indicating whether or not the machine
    requires a reboot for the invoked changes to take effect
  returned: always
  sample: true
  type: boolean
resource_name:
  description: The name of the invoked resource
  returned: always
  sample: windowsfeature
  type: string