Skip to content
Brandon Olin edited this page Jan 4, 2016 · 10 revisions

The defaults file is where you can store common resource configuration data that will be shared across multiple configurations. When each resource block in your configuration is processed, if it specifies a defaults file, those defaults will be converted into a hashtable that will get merged with the hashtable of the resource. If there are any duplicates between the defaults file and the resource block, the values from the resource block will be used.

######file_defaults.psd1

@{
    ensure = 'present'
    path = 'c:\'
    contents = 'this is some content'
}

######files.ps1

resource 'POSHOrigin:POSHFile' 'file1.txt' @{
    defaults = '.\file_defaults.psd1'
}

The examples above are the equivalent of specifying all options in the configuration file.

######create_file.ps1

resource 'POSHOrigin:POSHFile' 'file1.txt' @{
    ensure = 'present'
    path = 'c:\'
    contents = 'this is some content'
}

Clone this wiki locally