Last active
October 7, 2015 20:43
-
-
Save echohack/68ea3a61a5f4042357ae to your computer and use it in GitHub Desktop.
dsc gotchas
This file contains hidden or 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
if (platform_family? 'windows') && (node['kernel']['name'] == 'Microsoft Windows Server 2012 R2 Standard') | |
# Apply the Local Configuration Manager for DSC. | |
# DSC by default runs a consistancy check once every 15 minutes. | |
# Disable this because it causes collisions with chef-client runs. | |
powershell_script 'apply_lcm' do | |
code <<-EOH | |
configuration LCM | |
{ | |
LocalConfigurationManager | |
{ | |
ConfigurationMode = "ApplyOnly" | |
} | |
} | |
LCM -OutputPath #{node['base']['file_cache_path']} | |
Set-DscLocalConfigurationManager -Path #{node['base']['file_cache_path']} | |
EOH | |
not_if '(Get-DscLocalConfigurationManager).ConfigurationMode -eq "ApplyOnly"' | |
end | |
# install dsc web administration extension | |
remote_file File.join(Chef::Config['file_cache_path'], File.basename(dsc_kit_url)) do | |
source dsc_kit_url | |
end | |
dsc_script 'get-dsc-kit' do | |
code <<-EOH | |
Archive dsckit | |
{ | |
ensure = 'Present' | |
path = "#{File.join(Chef::Config['file_cache_path'], File.basename(dsc_kit_url))}" | |
destination = "#{ENV['PROGRAMW6432']}\\WindowsPowerShell\\Modules" | |
} | |
EOH | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment