This module is Alpha
Module for working with Windows PowerShell DSC (Desired State Configuration)
This module applies DSC Configurations in the form of PowerShell scripts or MOF (Managed Object Format) schema files.
Use the psget
module to manage PowerShell resources.
The idea is to leverage Salt to push DSC configuration scripts or MOF files to the Minion.
depends: |
|
---|
salt.modules.win_dsc.
apply_config
(path, source=None, salt_env='base')¶Run an compiled DSC configuration (a folder containing a .mof file). The
folder can be cached from the salt master using the source
option.
Parameters: |
|
---|---|
Returns: | True if successful, otherwise False |
Return type: |
CLI Example:
To apply a config that already exists on the the system
salt '*' dsc.run_config C:\\DSC\\WebSiteConfiguration
To cache a configuration from the master and apply it:
salt '*' dsc.run_config C:\\DSC\\WebSiteConfiguration salt://dsc/configs/WebSiteConfiguration
salt.modules.win_dsc.
compile_config
(path, source=None, config_name=None, config_data=None, config_data_source=None, script_parameters=None, salt_env='base')¶Compile a config from a PowerShell script (.ps1
)
Parameters: |
|
---|---|
Returns: | A dictionary containing the results of the compilation |
Return type: |
CLI Example:
To compile a config from a script that already exists on the system:
salt '*' dsc.compile_config C:\\DSC\\WebsiteConfig.ps1
To cache a config script to the system from the master and compile it:
salt '*' dsc.compile_config C:\\DSC\\WebsiteConfig.ps1 salt://dsc/configs/WebsiteConfig.ps1
salt.modules.win_dsc.
get_config
()¶Get the current DSC Configuration
Returns: | A dictionary representing the DSC Configuration on the machine |
---|---|
Return type: | dict |
CLI Example:
salt '*' dsc.get_config
salt.modules.win_dsc.
get_config_status
()¶Get the status of the current DSC Configuration
Returns: |
|
---|---|
Return type: | dict |
CLI Example:
salt '*' dsc.get_config_status
salt.modules.win_dsc.
get_lcm_config
()¶Get the current Local Configuration Manager settings
Returns: |
|
---|---|
Return type: | dict |
CLI Example:
salt '*' dsc.get_lcm_config
salt.modules.win_dsc.
run_config
(path, source=None, config_name=None, config_data=None, config_data_source=None, script_parameters=None, salt_env='base')¶Compile a DSC Configuration in the form of a PowerShell script (.ps1) and
apply it. The PowerShell script can be cached from the master using the
source
option. If there is more than one config within the PowerShell
script, the desired configuration can be applied by passing the name in the
config
option.
This command would be the equivalent of running dsc.compile_config
and
dsc.apply_config
separately.
Parameters: |
|
---|---|
Returns: | True if successfully compiled and applied, False if not |
Return type: |
CLI Example:
To compile a config from a script that already exists on the system:
salt '*' dsc.compile_apply_config C:\\DSC\\WebsiteConfig.ps1
To cache a config script to the system from the master and compile it:
salt '*' dsc.compile_apply_config C:\\DSC\\WebsiteConfig.ps1 salt://dsc/configs/WebsiteConfig.ps1
salt.modules.win_dsc.
set_lcm_config
(config_mode=None, config_mode_freq=None, refresh_freq=None, reboot_if_needed=None, action_after_reboot=None, refresh_mode=None, certificate_id=None, configuration_id=None, allow_module_overwrite=None, debug_mode=False, status_retention_days=None)¶For detailed descriptions of the parameters see: https://msdn.microsoft.com/en-us/PowerShell/DSC/metaConfig
Parameters: |
|
---|
:param .. note:: Either config_mode_freq or refresh_freq needs to be a: multiple of the other. See documentation on MSDN for more details. :param reboot_if_needed: Reboot the machine if needed after a
configuration is applied. Default is False.
Parameters: |
|
---|---|
Returns: | True if successful, otherwise False |
Return type: |
CLI Example:
salt '*' dsc.set_lcm_config ApplyOnly
Docs for previous releases are available on readthedocs.org.
Latest Salt release: 2017.7.1