Skip to content

Instantly share code, notes, and snippets.

@echohack
Created February 20, 2015 19:25
Show Gist options
  • Save echohack/d42bb1ed6d3129461136 to your computer and use it in GitHub Desktop.
Save echohack/d42bb1ed6d3129461136 to your computer and use it in GitHub Desktop.
Set DSC LocalConfigurationManager with Chef
# Apply the Local Configuration Manager for DSC.
# DSC by default runs a consistancy check once every 15 minutes.
# We disable this because it causes collisions with chef-client runs.
powershell_script 'apply_lcm' do
code <<-EOH
configuration LCM
{
LocalConfigurationManager
{
ConfigurationMode = "ApplyOnly"
}
}
LCM -OutputPath #{Chef::Config['file_cache_path']}
Set-DscLocalConfigurationManager -Path #{Chef::Config['file_cache_path']}
EOH
not_if '(Get-DscLocalConfigurationManager).ConfigurationMode -eq "ApplyOnly"'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment