win_dsc - Invokes a PowerShell DSC configuration

New in version 2.4.

Synopsis

  • 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.

Options

parameter required default choices comments
module_version
no latest
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.
resource_name
yes
The DSC Resource to use. Must be accessible to PowerShell using any of the default paths.

Examples

# Playbook example
  - name: Extract zip file
    win_dsc:
      resource_name: archive
      ensure: Present
      path: "C:\\Temp\\zipfile.zip"
      destination: "C:\\Temp\\Temp2"

  - name: Invoke DSC with check mode
    win_dsc:
      resource_name: windowsfeature
      name: telnet-client

Return Values

Common return values are documented here Return Values, the following are the fields unique to this module:

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

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

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

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.4/win_dsc_module.html