ansible.windows.dsc3 module – Sets or checks DSC v3 configuration state
Note
This module is part of the ansible.windows collection (version 3.3.0).
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 ansible.windows.
To use it in a playbook, specify: ansible.windows.dsc3.
New in ansible.windows 3.4.0
Synopsis
Calls
dsc config setordsc config testusingconfigas the configuration document.This module assumes that
dsccan be found usingPATHenvironment variable, anddscitself relies onPATHfor resource discovery. Manipulate the environment variable directly ifdscis not already discoverable usingPATH.
Note
This module has a corresponding action plugin.
Parameters
Parameter |
Comments |
|---|---|
The DSC configuration document to set or test. See https://learn.microsoft.com/en-us/powershell/dsc/concepts/configuration-documents/overview?view=dsc-3.0 for an overview of how to author a configuration document. The One of |
|
Path to DSC configuration document either on the control node or the target host. The This corresponds to the One of |
|
Runtime parameter values. This corresponds to the |
|
Whether the provided If A local Choices:
|
|
Specify level of tracing output, which are returned in This corresponds to the Choices:
|
Examples
- name: Install DSC3 using WinGet
ansible.windows.win_command:
argv:
- winget
- install
- --id=Microsoft.DSC
- --exact
- --source=winget
- --scope=machine
- --accept-package-agreements
- --accept-source-agreements
- --disable-interactivity
creates: '{{ ansible_env.ProgramFiles }}\WinGet\Links\dsc.exe'
- name: Install .NET Framework SDK from winget
ansible.windows.dsc3:
config:
resources:
- name: Install .NET Framework
type: Microsoft.WinGet/Package
properties:
id: Microsoft.DotNet.Framework.DeveloperPack_4
source: winget
- name: Install Visual Studio Build Tools
ansible.windows.dsc3:
config:
resources:
- name: Install Visual Studio
type: Microsoft.WinGet/Package
properties:
id: Microsoft.VisualStudio.2022.{{ vs_product }}
source: winget
- name: Install Visual Studio components
type: Microsoft.VisualStudio.DSC/VSComponents
properties:
productId: Microsoft.VisualStudio.Product.{{ vs_product }}
channelId: VisualStudio.17.Release
components:
- Microsoft.VisualStudio.Component.VC.14.44.17.14.x86.x64
- Microsoft.VisualStudio.Component.Windows11SDK.22621
vars:
vs_product: BuildTools
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
Exit code of Returned: always |
|
Result object returned by The exact schema of this object depends on the command used to invoke Returned: success |
|
Details regarding the DSC execution. Returned: success |
|
List of results from each resource that were configured. The schema of each item depends on the DSC operation used, and the resource’s type. Returned: success |
|
Logging and tracing messages from May be empty if no messages were emitted at the levels allowed by Returned: always |