Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GH-476] Allow specifying install method for windows_feature resources #477

Merged
merged 6 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,20 @@ jobs:
os:
- "windows-2019"
suite:
- "default"
- "disable-default"
- "app"
- "config-property"
- "manager"
- "manager-permission"
- "module"
- "pool"
- "root"
- "section"
- "site"
- "vdir"
- 'default'
- 'disable-default'
- 'app'
- 'config-property'
- 'manager'
- 'manager-permission'
- 'module'
- 'pool'
- 'root'
- 'section'
- 'site'
- 'vdir'
- 'default-windowsfeatures-powershell'
- 'site-windowsfeatures-powershell'
fail-fast: false

steps:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## Unreleased

- Allow specifying install method for windows_feature resources

## 8.0.20 - *2023-09-28*

## 8.0.19 - *2023-09-04*
Expand Down Expand Up @@ -261,19 +263,19 @@

## 5.0.8 (2017-03-13)

- [iis-root default_documents broke from last fix](#306)

Check failure on line 266 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / lint-unit / markdownlint-cli2

Link fragments should be valid

CHANGELOG.md:266:3 MD051/link-fragments Link fragments should be valid [Context: "[iis-root default_documents broke from last fix](#306)"] https://github.com/DavidAnson/markdownlint/blob/v0.30.0/doc/md051.md

## 5.0.7 (2017-03-07)

- [iis-root default_documents deleted every chef run](#306)

Check failure on line 270 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / lint-unit / markdownlint-cli2

Link fragments should be valid

CHANGELOG.md:270:3 MD051/link-fragments Link fragments should be valid [Context: "[iis-root default_documents deleted every chef run](#306)"] https://github.com/DavidAnson/markdownlint/blob/v0.30.0/doc/md051.md

## 5.0.6 (2017-02-24)

- [iis_version is not evaluated properly on if statement](#308)

Check failure on line 274 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / lint-unit / markdownlint-cli2

Link fragments should be valid

CHANGELOG.md:274:3 MD051/link-fragments Link fragments should be valid [Context: "[iis_version is not evaluated properly on if statement](#308)"] https://github.com/DavidAnson/markdownlint/blob/v0.30.0/doc/md051.md

## 5.0.5 (2016-11-21)

- [Fixed no_managed_code idempotency](#301)

Check failure on line 278 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / lint-unit / markdownlint-cli2

Link fragments should be valid

CHANGELOG.md:278:3 MD051/link-fragments Link fragments should be valid [Context: "[Fixed no_managed_code idempotency](#301)"] https://github.com/DavidAnson/markdownlint/blob/v0.30.0/doc/md051.md

## 5.0.4 (2016-10-11)

Expand All @@ -285,8 +287,8 @@

## 5.0.2 (2016-10-07)

- [Minor over oversight in IIS::mod_aspnet 5.0.1](#296)

Check failure on line 290 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / lint-unit / markdownlint-cli2

Link fragments should be valid

CHANGELOG.md:290:3 MD051/link-fragments Link fragments should be valid [Context: "[Minor over oversight in IIS::mod_aspnet 5.0.1](#296)"] https://github.com/DavidAnson/markdownlint/blob/v0.30.0/doc/md051.md
- [IIS Pool resource thirty_two_bit false doesn't](#292)

Check failure on line 291 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / lint-unit / markdownlint-cli2

Link fragments should be valid

CHANGELOG.md:291:3 MD051/link-fragments Link fragments should be valid [Context: "[IIS Pool resource thirty_two_bit false doesn't](#292)"] https://github.com/DavidAnson/markdownlint/blob/v0.30.0/doc/md051.md

## 5.0.1 (2016-09-21)

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of
- `node['iis']['pubroot']` - . default is `%SYSTEMDRIVE%\inetpub`
- `node['iis']['docroot']` - IIS web site home directory. default is `%SYSTEMDRIVE%\inetpub\wwwroot`
- `node['iis']['cache_dir']` - location of cached data. default is `%SYSTEMDRIVE%\inetpub\temp`
- `node['iis']['windows_feature_install_method']` - specify the install method that will be used by any windows_feature resources. If ommitted it will not be specified and will use `windows_feature_dism` by default. Valid options are `:windows_feature_dism`, `:windows_feature_powershell`, `:windows_feature_servermanagercmd`. Default is `:windows_feature_dism`

## Resources

Expand Down
2 changes: 2 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@
default['iis']['source'] = nil

default['iis']['recycle']['log_events'] = 'Time, Requests, Schedule, Memory, IsapiUnhealthy, OnDemand, ConfigChange, PrivateMemory'

default['iis']['windows_feature_install_method'] = :windows_feature_dism
10 changes: 6 additions & 4 deletions documentation/iis_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ Simple resource to install the IIS feature

## Properties

| Name | Type | Required| Description |
| ----------------------- | -------- | -------- | ------------------------------------ |
| `source` | String | No | Source to install the features from. |
| `additional_components` | Array | No | Features of IIS to install |
| Name | Type | Required| Description |
| ----------------------- | -------------- | -------- | ------------------------------------ |
| `source` | String | No | Source to install the features from. |
| `additional_components` | String,Array | No | Features of IIS to install |
| `install_method` | String, Symbol| No | install_method to be used to any windows_features resources. Default is :windows_feature_dism. Options are :windows_feature_dism, :windows_feature_powershell |
| `start_iis` | true, false | No | Controls whether the W3WVC service is enabled and started. Default is false

## Examples

Expand Down
11 changes: 6 additions & 5 deletions documentation/iis_manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ Configures the IIS Manager service

## Properties

| Name | Type | Default | Description |
| --------------------------- | ------------- | ------- | ------------------------------------ |
| `enable_remote_management` | true, false | `true` | If remote access allowed |
| `log_directory` | String | | Optional. The directory to write log files to |
| `port` | Integer | `8172` | The port the service listens on. |
| Name | Type | Default | Description |
| --------------------------- | --------------- | ------- | ------------------------------------ |
| `enable_remote_management` | true, false | `true` | If remote access allowed |
| `log_directory` | String | | Optional. The directory to write log files to |
| `port` | Integer | `8172` | The port the service listens on. |
| `install_method` | String, Symbol | `:windows_feature_dism` | Optional. install_method to be used to any windows_features resources. Valid options are :windows_feature_dism, :windows_feature_powershell |

## Examples

Expand Down
18 changes: 18 additions & 0 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,21 @@ suites:
- name: vdir
run_list:
- recipe[test::vdir]
- name: default-windowsfeatures-powershell
run_list:
- recipe[iis::default]
verifier:
inspec_tests:
- test/integration/default/spec
attributes:
iis:
windows_feature_install_method: windows_feature_powershell
- name: site-windowsfeatures-powershell
run_list:
- recipe[test::site]
verifier:
inspec_tests:
- test/integration/site
attributes:
iis:
windows_feature_install_method: windows_feature_powershell
7 changes: 2 additions & 5 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
iis_install 'install IIS' do
additional_components node['iis']['components']
source node['iis']['source']
end

service 'iis' do
service_name 'W3SVC'
action [:enable, :start]
install_method node['iis']['windows_feature_install_method']
start_iis true
end
9 changes: 6 additions & 3 deletions recipes/mod_application_initialization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature 'IIS-ApplicationInit'
iis_install 'install IIS, ApplicationInit' do
additional_components 'IIS-ApplicationInit'
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
14 changes: 7 additions & 7 deletions recipes/mod_aspnet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
# limitations under the License.
#

include_recipe 'iis'
include_recipe 'iis::mod_isapi'

windows_feature %w(IIS-NetFxExtensibility IIS-ASPNET) do
action :install
all !IISCookbook::Helper.older_than_windows2012?
source node['iis']['source'] unless node['iis']['source'].nil?
iis_install 'install IIS, ASPNET' do
additional_components %w(IIS-NetFxExtensibility IIS-ASPNET)
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end

include_recipe 'iis::mod_isapi'
10 changes: 7 additions & 3 deletions recipes/mod_aspnet45.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
# limitations under the License.
#

include_recipe 'iis'
include_recipe 'iis::mod_isapi'
iis_install 'install IIS, ASPNET45' do
additional_components %w(NetFx4Extended-ASPNET45 IIS-NetFxExtensibility45 IIS-ASPNET45)
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end

windows_feature %w(NetFx4Extended-ASPNET45 IIS-NetFxExtensibility45 IIS-ASPNET45)
include_recipe 'iis::mod_isapi'
6 changes: 5 additions & 1 deletion recipes/mod_auth_anonymous.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
# limitations under the License.
#

include_recipe 'iis'
iis_install 'install IIS' do
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end

iis_section 'unlocks anonymous authentication control in web.config' do
section 'system.webServer/security/authentication/anonymousAuthentication'
Expand Down
9 changes: 6 additions & 3 deletions recipes/mod_auth_basic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature 'IIS-BasicAuthentication'
iis_install 'install IIS, BasicAuth' do
additional_components 'IIS-BasicAuthentication'
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end

iis_section 'unlocks basic authentication control in web.config' do
section 'system.webServer/security/authentication/basicAuthentication'
Expand Down
9 changes: 6 additions & 3 deletions recipes/mod_auth_digest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature 'IIS-DigestAuthentication'
iis_install 'install IIS, DigestAuth' do
additional_components 'IIS-DigestAuthentication'
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end

iis_section 'unlocks digest authentication control in web.config' do
section 'system.webServer/security/authentication/digestAuthentication'
Expand Down
9 changes: 6 additions & 3 deletions recipes/mod_auth_windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature 'IIS-WindowsAuthentication'
iis_install 'install IIS, WindowsAuth' do
additional_components 'IIS-WindowsAuthentication'
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end

iis_section 'unlocks windows authentication control in web.config' do
section 'system.webServer/security/authentication/windowsAuthentication'
Expand Down
9 changes: 6 additions & 3 deletions recipes/mod_cgi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature 'IIS-CGI'
iis_install 'install IIS, CGI' do
additional_components 'IIS-CGI'
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
9 changes: 6 additions & 3 deletions recipes/mod_compress_dynamic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature 'IIS-HttpCompressionDynamic'
iis_install 'install IIS, HttpCompressionDynamic' do
additional_components 'IIS-HttpCompressionDynamic'
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
9 changes: 6 additions & 3 deletions recipes/mod_compress_static.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature 'IIS-HttpCompressionStatic'
iis_install 'install IIS, HttpCompressionStatic' do
additional_components 'IIS-HttpCompressionStatic'
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
9 changes: 6 additions & 3 deletions recipes/mod_ftp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature %w(IIS-FTPServer IIS-FTPSvc IIS-FTPExtensibility)
iis_install 'install IIS, FTP' do
additional_components %w(IIS-FTPServer IIS-FTPSvc IIS-FTPExtensibility)
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
9 changes: 6 additions & 3 deletions recipes/mod_iis6_metabase_compat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature %w(IIS-IIS6ManagementCompatibility IIS-Metabase)
iis_install 'install IIS, Compatability, Metabase' do
additional_components %w(IIS-IIS6ManagementCompatibility IIS-Metabase)
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
9 changes: 6 additions & 3 deletions recipes/mod_isapi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature %w(IIS-ISAPIFilter IIS-ISAPIExtensions)
iis_install 'install IIS, ISAPI' do
additional_components %w(IIS-ISAPIFilter IIS-ISAPIExtensions)
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
9 changes: 6 additions & 3 deletions recipes/mod_logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature 'IIS-CustomLogging'
iis_install 'install IIS, CustomLogging' do
additional_components 'IIS-CustomLogging'
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
10 changes: 5 additions & 5 deletions recipes/mod_management.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature %w(IIS-ManagementConsole IIS-ManagementService) do
action :install
all !IISCookbook::Helper.older_than_windows2012?
iis_install 'install IIS, Management' do
additional_components %w(IIS-ManagementConsole IIS-ManagementService)
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
9 changes: 6 additions & 3 deletions recipes/mod_security.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature %w(IIS-URLAuthorization IIS-RequestFiltering IIS-IPSecurity)
iis_install 'install IIS, Security' do
additional_components %w(IIS-URLAuthorization IIS-RequestFiltering IIS-IPSecurity)
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
9 changes: 6 additions & 3 deletions recipes/mod_tracing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature 'IIS-HttpTracing'
iis_install 'install IIS, Tracing' do
additional_components 'IIS-HttpTracing'
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
Loading
Loading