Skip to content

Instantly share code, notes, and snippets.

@brettski
Created November 23, 2016 16:14
Show Gist options
  • Save brettski/71be30ac33cf90b8d7b52bcacfd48c91 to your computer and use it in GitHub Desktop.
Save brettski/71be30ac33cf90b8d7b52bcacfd48c91 to your computer and use it in GitHub Desktop.
Lcm recipe, how to stub the not_if?
powershell_script 'Configure the LCM' do
code <<-EOH
Configuration ConfigLCM
{
Node "localhost"
{
LocalConfigurationManager
{
ConfigurationMode = "ApplyOnly"
RebootNodeIfNeeded = $false
}
}
}
ConfigLCM -OutputPath "#{Chef::Config[:file_cache_path]}\\DSC_LCM"
Set-DscLocalConfigurationManager -Path "#{Chef::Config[:file_cache_path]}\\DSC_LCM"
EOH
not_if '(Get-DscLocalConfigurationManager |select -ExpandProperty "ConfigurationMode") -eq "ApplyOnly"'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment