Created
April 22, 2021 15:51
-
-
Save gaelcolas/ca8bc14b5846ab72f446961ea0a9dde1 to your computer and use it in GitHub Desktop.
basic jinja composite with explicit parameters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Configuration MyComposite { | |
Params ( | |
$TemplateFilePath = 'MyJinja2Template.tpl', | |
$parameter1, | |
$parameter2 | |
) | |
$tempParamFile = [io.Path]::GetTempFileName() | |
@{ | |
Param1 = $parameter1 | |
Param2 = $parameter2 | |
} | ConvertTo-Json | out-file -FilePath $tempParamFile -Force | |
# if you're in Datum, you can just get the RSOP (resultant set of policy) of the data for the current node, and export to JSON. | |
$jinja2Result = jinja2 @($TemplateFilePath,$tempParamFile,'--format=json') | |
nxFile MyConfigFile { | |
DestinationPath = '/etc/myconfig' | |
Contents = $tempParamFile | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment