Powershell Desired State Configuration (Contd..)
DSC Configuration files
- DSC Configuration script file is a powershell script file (.ps1) that defines a special type of function Configuration
# First we declare the configuration
Configuration HelloDsc
{
# Then we need to declare where we want to run the Configurarion
Node "localhost"
{
# Then we declare the desired state using DSC Resources
Log MyMessage
{
Message = "Hello, Welcome to the World of DSC"
}
}
}
# Compile the configuration file
HelloDsc
- Authoring DSC Configuration requires us to understand
- DSC automatic Variables
- Configuration Data
- Configuration file
- DSC Resources
- To author the DSC Configuration, we need to defined the state and state definition at the lowest (atomic) level is done by DSC Resource
- DSC resources are Powershell modules that contain both the schema and implementation to determine and set the state on target Node
- Execute Get-DSCResource on the node
- Lets write a dsc configuration to install iis server on Target node
- Let try to find about one resource WindowsFeature Refer Here
- To Import DSC Resource Refer Here
- Refer Here for the changes made
- For Built in resources Refer Here refer to section windows built in resources
Configuration Data
- DSC Configuration Data
- Refer Here for the changes done
Like this:
Like Loading...