|
23 | 23 | setup_conf = node['wsus_server']['setup']
|
24 | 24 |
|
25 | 25 | setup_options = ''
|
26 |
| -if setup_conf['sqlinstance_name'] |
27 |
| - setup_options << if node['platform_version'].to_f >= 6.2 |
28 |
| - " SQL_INSTANCE_NAME=\"#{setup_conf['sqlinstance_name']}\"" |
29 |
| - else |
30 |
| - " SQLINSTANCE_NAME=\"#{setup_conf['sqlinstance_name']}\"" |
31 |
| - end |
32 |
| -end |
| 26 | +setup_options << " SQL_INSTANCE_NAME=\"#{setup_conf['sqlinstance_name']}\"" if setup_conf['sqlinstance_name'] |
33 | 27 |
|
34 | 28 | if setup_conf['content_dir']
|
35 | 29 | setup_options << " CONTENT_LOCAL=1 CONTENT_DIR=\"#{setup_conf['content_dir']}\""
|
|
39 | 33 | end
|
40 | 34 | end
|
41 | 35 |
|
42 |
| -require 'chef/win32/version' |
43 |
| -if node['platform_version'].to_f >= 6.2 |
44 |
| - [ |
45 |
| - 'NET-WCF-HTTP-Activation45', # This feature is required for KB3159706 |
46 |
| - 'UpdateServices', |
47 |
| - 'UpdateServices-UI', |
48 |
| - ].each do |feature_name| |
49 |
| - windows_feature feature_name do |
50 |
| - action :install |
51 |
| - install_method :windows_feature_powershell if respond_to? :install_method |
52 |
| - provider :windows_feature_powershell unless respond_to? :install_method |
53 |
| - end |
54 |
| - end |
55 |
| - |
56 |
| - windows_feature 'UpdateServices-WidDB' do |
57 |
| - action setup_conf['sqlinstance_name'] ? :remove : :install |
58 |
| - all true |
59 |
| - install_method :windows_feature_powershell if respond_to? :install_method |
60 |
| - provider :windows_feature_powershell unless respond_to? :install_method |
61 |
| - end |
62 |
| - |
63 |
| - windows_feature 'UpdateServices-DB' do |
64 |
| - action setup_conf['sqlinstance_name'] ? :install : :remove |
65 |
| - all true |
| 36 | +[ |
| 37 | + 'NET-WCF-HTTP-Activation45', # This feature is required for KB3159706 |
| 38 | + 'UpdateServices', |
| 39 | + 'UpdateServices-UI', |
| 40 | +].each do |feature_name| |
| 41 | + windows_feature feature_name do |
| 42 | + action :install |
66 | 43 | install_method :windows_feature_powershell if respond_to? :install_method
|
67 | 44 | provider :windows_feature_powershell unless respond_to? :install_method
|
68 | 45 | end
|
| 46 | +end |
69 | 47 |
|
70 |
| - guard_file = ::File.join(Chef::Config['file_cache_path'], 'wsus_postinstall') |
71 |
| - execute 'WSUS PostInstall' do |
72 |
| - command "WsusUtil.exe PostInstall #{setup_options}" |
73 |
| - cwd 'C:\Program Files\Update Services\Tools' |
74 |
| - not_if { ::File.exist?(guard_file) && ::File.read(guard_file) == setup_options } |
75 |
| - end |
76 |
| - |
77 |
| - file guard_file do |
78 |
| - path guard_file |
79 |
| - content setup_options |
80 |
| - end |
81 |
| -else |
82 |
| - setup_options << ' ENABLE_INVENTORY=' + (setup_conf['enable_inventory'] ? '1' : '0') |
83 |
| - setup_options << ' MU_ROLLUP=' + (setup_conf['join_improvement_program'] ? '1' : '0') |
84 |
| - setup_options << ' DEFAULT_WEBSITE=' + (setup_conf['use_default_website'] ? '1' : '0') |
85 |
| - setup_options << ' FRONTEND_SETUP=1 CREATE_DATABASE=0' if setup_conf['frontend_setup'] |
86 |
| - |
87 |
| - if setup_conf['wyukon_data_dir'] |
88 |
| - setup_options << " WYUKON_DATA_DIR=\"#{setup_conf['wyukon_data_dir']}\"" |
89 |
| - directory setup_conf['wyukon_data_dir'] { recursive true } |
90 |
| - end |
91 |
| - |
92 |
| - # WSUS 3.0 SP2 requires some IIS features: http://technet.microsoft.com/en-us/library/dd939916.aspx |
93 |
| - features = %w( |
94 |
| - IIS-WebServerRole |
95 |
| - IIS-WebServer |
96 |
| - IIS-ApplicationDevelopment |
97 |
| - IIS-ISAPIFilter |
98 |
| - IIS-ISAPIExtensions |
99 |
| - IIS-NetFxExtensibility |
100 |
| - IIS-ASPNET |
101 |
| - IIS-WindowsAuthentication |
102 |
| - IIS-HttpCompressionDynamic |
103 |
| - IIS-IIS6ManagementCompatibility |
104 |
| - IIS-WMICompatibility |
105 |
| - IIS-Metabase |
106 |
| - IIS-LegacyScripts |
107 |
| - ) |
108 |
| - |
109 |
| - # IIS 6 SnapIn is not compatible with core version |
110 |
| - features << 'IIS-LegacySnapIn' unless Chef::ReservedNames::Win32::Version.new.core? |
111 |
| - features.each do |feature_name| |
112 |
| - windows_feature feature_name do |
113 |
| - action :install |
114 |
| - install_method :windows_feature_powershell if respond_to? :install_method |
115 |
| - provider :windows_feature_powershell unless respond_to? :install_method |
116 |
| - end |
117 |
| - end |
| 48 | +windows_feature 'UpdateServices-WidDB' do |
| 49 | + action setup_conf['sqlinstance_name'] ? :remove : :install |
| 50 | + all true |
| 51 | + install_method :windows_feature_powershell if respond_to? :install_method |
| 52 | + provider :windows_feature_powershell unless respond_to? :install_method |
| 53 | +end |
118 | 54 |
|
119 |
| - include_recipe 'wsus-server::report_viewer' |
| 55 | +windows_feature 'UpdateServices-DB' do |
| 56 | + action setup_conf['sqlinstance_name'] ? :install : :remove |
| 57 | + all true |
| 58 | + install_method :windows_feature_powershell if respond_to? :install_method |
| 59 | + provider :windows_feature_powershell unless respond_to? :install_method |
| 60 | +end |
120 | 61 |
|
121 |
| - package_info = node['wsus_server']['package'] |
| 62 | +guard_file = ::File.join(Chef::Config['file_cache_path'], 'wsus_postinstall') |
| 63 | +execute 'WSUS PostInstall' do |
| 64 | + command "WsusUtil.exe PostInstall #{setup_options}" |
| 65 | + cwd 'C:\Program Files\Update Services\Tools' |
| 66 | + not_if { ::File.exist?(guard_file) && ::File.read(guard_file) == setup_options } |
| 67 | +end |
122 | 68 |
|
123 |
| - windows_package package_info['name'] do |
124 |
| - action :install |
125 |
| - installer_type :custom |
126 |
| - options "#{package_info['options']} #{setup_options}" |
127 |
| - source package_info['source'] |
128 |
| - checksum package_info['checksum'] |
129 |
| - end |
| 69 | +file guard_file do |
| 70 | + path guard_file |
| 71 | + content setup_options |
130 | 72 | end
|
131 | 73 |
|
132 | 74 | # Wsus does not need configuration when setup as frontend server
|
|
0 commit comments