Last active
May 7, 2018 04:47
-
-
Save Brantone/20b7c87e2c1810af9d0af6b140002475 to your computer and use it in GitHub Desktop.
Chef VisualStudio install loop
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
node['agent']['visualstudio']['versions'].each do |vs| | |
directory "#{Chef::Config[:file_cache_path]}\\visualstudio\\#{vs.version}\\" do | |
action :create | |
recursive true | |
end | |
remote_file "#{Chef::Config[:file_cache_path]}\\visualstudio\\#{vs.version}\\#{vs.installer}" do | |
action :create | |
source "#{node['agent']['software_repo_root']}/microsoft/vs#{vs.version}/#{vs.installer}" | |
checksum vs.checksum | |
end | |
cookbook_file "#{Chef::Config[:file_cache_path]}\\visualstudio\\#{vs.version}\\AdminDeployment.xml" do | |
action :create | |
source "#{vs.version}_AdminDeployment.xml" | |
notifies :run, "dsc_resource[VisualStudio #{vs.version}]", :immediately | |
end | |
dsc_resource "VisualStudio #{vs.version}" do | |
action :nothing | |
resource :package | |
property :name, vs.name | |
property :ensure, 'Present' | |
property :path, "#{Chef::Config[:file_cache_path]}\\visualstudio\\#{vs.version}\\#{vs.installer}" | |
property :arguments, "/norestart /adminfile #{Chef::Config[:file_cache_path]}\\visualstudio\\#{vs.version}\\AdminDeployment.xml" | |
property :productid, vs.productid | |
notifies :request_reboot, 'reboot[Rebooting to complete Microsoft agent installs]', :delayed | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment