Initial Chef repository
This commit is contained in:
183
cookbooks/iis/CHANGELOG.md
Normal file
183
cookbooks/iis/CHANGELOG.md
Normal file
@@ -0,0 +1,183 @@
|
||||
v4.1.1 (2015-05-07)
|
||||
-------------------
|
||||
- Detects changes in the physical path of apps.
|
||||
- Adds support for gMSA identity.
|
||||
- Performing add on a site will now reconfigure it if necessary.
|
||||
- Lock and unlock commands on configuration sections now use -commit:apphost.
|
||||
- Fix issue where popeline_mode was ignored during configuration of a pool.
|
||||
|
||||
v4.1.0 (2015-03-04)
|
||||
-------------------
|
||||
- Removed iis_pool attribute 'set_profile_environment' incompatible with < IIS-8.
|
||||
- Added pester test framework.
|
||||
- Condensed and fixed change-log to show public releases only.
|
||||
- Fixed bug where bindings were being overwritten by :config.
|
||||
- Code-cleanup and cosmetic fixes.
|
||||
|
||||
v4.0.0 (2015-02-12)
|
||||
-------------------
|
||||
- [#91](https://github.com/chef-cookbooks/iis/pull/91) - bulk addition of new features
|
||||
- Virtual Directory Support (allows virtual directories to be added to both websites and to webapplications under sites).
|
||||
- section unlock and lock support (this is used to allow for the web.config of a site to define the authentication methods).
|
||||
- fixed issue with :add on pool provider not running all config (this was a known issue and is now resolved).
|
||||
- fixed issue with :config on all providers causing application pool recycles (every chef-client run).
|
||||
- moved to better method for XML checking of previous settings to detect changes (changed all check to use xml searching with appcmd instead of the previous method [none]).
|
||||
- Improved pool resource with many more apppool properties that can be set.
|
||||
- Fixed bug with default attribute inheritance.
|
||||
- New recipe to enable ASP.NET 4.5.
|
||||
- Skeleton serverspec+test-kitchen framework.
|
||||
- Added Berksfile, Gemfile and .kitchen.yml to assist developers.
|
||||
- Fixed issue [#107] function is_new_or_empty was returning reverse results.
|
||||
- Removed dependency on "chef-client", ">= 3.7.0".
|
||||
- Changed all files to UTF-8 file format.
|
||||
- Fixed issue with iis_pool not putting ApplicationPoolIdentity and username/password.
|
||||
- [#98] Fixed issues with bindings.
|
||||
- added backwards compatibility for chef-client < 12.x.x Chef::Util::PathHelper.
|
||||
|
||||
v2.1.6 (2014-11-12)
|
||||
-------------------
|
||||
- [#78] Adds new_resource.updated_by_last_action calls
|
||||
|
||||
v2.1.5 (2014-09-15)
|
||||
-------------------
|
||||
- [#68] Add win_friendly_path to all appcmd.exe /physicalPath arguments
|
||||
|
||||
v2.1.4 (2014-09-13)
|
||||
-------------------
|
||||
- [#72] Adds chefspec matchers
|
||||
- [#57] Fixes site_id not being updated on a :config action
|
||||
|
||||
v2.1.2 (2014-04-23)
|
||||
-------------------
|
||||
- [COOK-4559] Remove invalid UTF-8 characters
|
||||
|
||||
|
||||
v2.1.0 (2014-03-25)
|
||||
-------------------
|
||||
[COOK-4426] - feature order correction for proper installation
|
||||
[COOK-4428] - Add IIS FTP Feature Installation
|
||||
|
||||
|
||||
v2.0.4 (2014-03-18)
|
||||
-------------------
|
||||
- [COOK-4420] Corrected incorrect feature names for mod_security
|
||||
|
||||
|
||||
v2.0.2 (2014-02-25)
|
||||
-------------------
|
||||
- [COOK-4108] - Add documentation for the 'bindings' attribute in 'iis_site' LWRP
|
||||
|
||||
|
||||
v2.0.0 (2014-01-03)
|
||||
-------------------
|
||||
Major version bump
|
||||
|
||||
|
||||
v1.6.6
|
||||
------
|
||||
Adding extra windows platform checks to helper library
|
||||
|
||||
|
||||
v1.6.4
|
||||
------
|
||||
### Bug
|
||||
- **[COOK-4138](https://tickets.chef.io/browse/COOK-4138)** - iis cookbook won't load on non-Windows platforms
|
||||
|
||||
|
||||
v1.6.2
|
||||
------
|
||||
### Improvement
|
||||
- **[COOK-3634](https://tickets.chef.io/browse/COOK-3634)** - provide ability to set app pool managedRuntimeVersion to "No Managed Code"
|
||||
|
||||
|
||||
v1.6.0
|
||||
------
|
||||
### Improvement
|
||||
- **[COOK-3922](https://tickets.chef.io/browse/COOK-3922)** - refactor IIS cookbook to not require WebPI
|
||||
|
||||
|
||||
v1.5.6
|
||||
------
|
||||
### Improvement
|
||||
- **[COOK-3770](https://tickets.chef.io/browse/COOK-3770)** - Add Enabled Protocols to IIS App Recipe
|
||||
|
||||
|
||||
v1.5.4
|
||||
------
|
||||
### New Feature
|
||||
- **[COOK-3675](https://tickets.chef.io/browse/COOK-3675)** - Add recipe for CGI module
|
||||
|
||||
v1.5.2
|
||||
------
|
||||
### Bug
|
||||
- **[COOK-3232](https://tickets.chef.io/browse/COOK-3232)** - Allow `iis_app` resource `:config` action with a virtual path
|
||||
|
||||
v1.5.0
|
||||
------
|
||||
### Improvement
|
||||
|
||||
- [COOK-2370]: add MVC2, escape `application_pool` and add options for
|
||||
recycling
|
||||
- [COOK-2694]: update iis documentation to show that Windows 2012 and
|
||||
Windows 8 are supported
|
||||
|
||||
### Bug
|
||||
|
||||
- [COOK-2325]: `load_current_resource` does not load state of pool
|
||||
correctly, always sets running to false
|
||||
- [COOK-2526]: Installing IIS after .NET framework will leave
|
||||
installation in non-working state
|
||||
- [COOK-2596]: iis cookbook fails with indecipherable error if EULA
|
||||
not accepted
|
||||
|
||||
v1.4.0
|
||||
------
|
||||
* [COOK-2181] -Adding full module support to iis cookbook
|
||||
|
||||
v1.3.6
|
||||
------
|
||||
* [COOK-2084] - Add support for additional options during site creation
|
||||
* [COOK-2152] - Add recipe for IIS6 metabase compatibility
|
||||
|
||||
v1.3.4
|
||||
------
|
||||
* [COOK-2050] - IIS cookbook does not have returns resource defined
|
||||
|
||||
v1.3.2
|
||||
------
|
||||
* [COOK-1251] - Fix LWRP "NotImplementedError"
|
||||
|
||||
v1.3.0
|
||||
------
|
||||
* [COOK-1301] - Add a recycle action to the iis_pool resource
|
||||
* [COOK-1665] - app pool identity and new node[iis][component] attribute
|
||||
* [COOK-1666] - Recipe to remove default site and app pool
|
||||
* [COOK-1858] - Recipe misspelled
|
||||
|
||||
v1.2.0
|
||||
------
|
||||
* [COOK-1061] - `iis_site` doesn't allow setting the pool
|
||||
* [COOK-1078] - handle advanced bindings
|
||||
* [COOK-1283] - typo on pool
|
||||
* [COOK-1284] - install iis application initialization
|
||||
* [COOK-1285] - allow multiple host_header, port and protocol
|
||||
* [COOK-1286] - allow directly setting which app pool on site creation
|
||||
* [COOK-1449] - iis pool regex returns true if similar site exists
|
||||
* [COOK-1647] - mod_ApplicationInitialization isn't RC
|
||||
|
||||
v1.1.0
|
||||
------
|
||||
* [COOK-1012] - support adding apps
|
||||
* [COOK-1028] - support for config command
|
||||
* [COOK-1041] - fix removal in app pools
|
||||
* [COOK-835] - add app pool management
|
||||
* [COOK-950] - documentation correction for version of IIS/OS
|
||||
|
||||
v1.0.2
|
||||
------
|
||||
* Ruby 1.9 compat fixes
|
||||
* ensure carriage returns are removed before applying regex
|
||||
|
||||
v1.0.0
|
||||
------
|
||||
* [COOK-718] initial release
|
||||
458
cookbooks/iis/README.md
Normal file
458
cookbooks/iis/README.md
Normal file
@@ -0,0 +1,458 @@
|
||||
Description
|
||||
===========
|
||||
|
||||
Installs and configures Microsoft Internet Information Services (IIS) 7.0/7.5/8.0
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
Platform
|
||||
--------
|
||||
|
||||
* Windows Vista
|
||||
* Windows 7
|
||||
* Windows 8
|
||||
* Windows Server 2008 (R1, R2)
|
||||
* Windows Server 2012
|
||||
* Windows Server 2012R2
|
||||
|
||||
Windows 2003R2 is *not* supported because it lacks Add/Remove Features.
|
||||
|
||||
Cookbooks
|
||||
---------
|
||||
|
||||
* windows
|
||||
|
||||
Attributes
|
||||
==========
|
||||
|
||||
* `node['iis']['home']` - IIS main home directory. default is `%WINDIR%\System32\inetsrv`
|
||||
* `node['iis']['conf_dir']` - location where main IIS configs lives. default is `%WINDIR%\System32\inetsrv\config`
|
||||
* `node['iis']['pubroot']` - . default is `%SYSTEMDRIVE%\inetpub`
|
||||
* `node['iis']['docroot']` - IIS web site home directory. default is `%SYSTEMDRIVE%\inetpub\wwwroot`
|
||||
* `node['iis']['log_dir']` - location of IIS logs. default is `%SYSTEMDRIVE%\inetpub\logs\LogFiles`
|
||||
* `node['iis']['cache_dir']` - location of cached data. default is `%SYSTEMDRIVE%\inetpub\temp`
|
||||
|
||||
Resource/Provider
|
||||
=================
|
||||
|
||||
iis_site
|
||||
---------
|
||||
|
||||
Allows easy management of IIS virtual sites (ie vhosts).
|
||||
|
||||
### Actions
|
||||
|
||||
- `:add` - add a new virtual site
|
||||
- `:config` - apply configuration to an existing virtual site
|
||||
- `:delete` - delete an existing virtual site
|
||||
- `:start` - start a virtual site
|
||||
- `:stop` - stop a virtual site
|
||||
- `:restart` - restart a virtual site
|
||||
|
||||
### Attribute Parameters
|
||||
|
||||
- `product_id` - name attribute. Specifies the ID of a product to install.
|
||||
- `site_name` - name attribute.
|
||||
- `site_id` - if not given IIS generates a unique ID for the site
|
||||
- `path` - IIS will create a root application and a root virtual directory mapped to this specified local path
|
||||
- `protocol` - http protocol type the site should respond to. valid values are :http, :https. default is :http
|
||||
- `port` - port site will listen on. default is 80
|
||||
- `host_header` - host header (also known as domains or host names) the site should map to. default is all host headers
|
||||
- `options` - additional options to configure the site
|
||||
- `bindings` - Advanced options to configure the information required for requests to communicate with a Web site. See http://www.iis.net/configreference/system.applicationhost/sites/site/bindings/binding for parameter format. When binding is used, port protocol and host_header should not be used.
|
||||
- `application_pool` - set the application pool of the site
|
||||
- `options` - support for additional options -logDir, -limits, -ftpServer, etc...
|
||||
- `log_directory` - specifies the logging directory, where the log file and logging-related support files are stored.
|
||||
- `log_period` - specifies how often iis creates a new log file
|
||||
- `log_truncsize` - specifies the maximum size of the log file (in bytes) after which to create a new log file.
|
||||
|
||||
### Examples
|
||||
|
||||
```ruby
|
||||
# stop and delete the default site
|
||||
iis_site 'Default Web Site' do
|
||||
action [:stop, :delete]
|
||||
end
|
||||
```
|
||||
|
||||
```ruby
|
||||
# create and start a new site that maps to
|
||||
# the physical location C:\inetpub\wwwroot\testfu
|
||||
iis_site 'Testfu Site' do
|
||||
protocol :http
|
||||
port 80
|
||||
path "#{node['iis']['docroot']}/testfu"
|
||||
action [:add,:start]
|
||||
end
|
||||
```
|
||||
|
||||
```ruby
|
||||
# do the same but map to testfu.chef.io domain
|
||||
iis_site 'Testfu Site' do
|
||||
protocol :http
|
||||
port 80
|
||||
path "#{node['iis']['docroot']}/testfu"
|
||||
host_header "testfu.chef.io"
|
||||
action [:add,:start]
|
||||
end
|
||||
```
|
||||
|
||||
```ruby
|
||||
# create and start a new site that maps to
|
||||
# the physical C:\inetpub\wwwroot\testfu
|
||||
# also adds bindings to http and https
|
||||
# binding http to the ip address 10.12.0.136,
|
||||
# the port 80, and the host header www.domain.com
|
||||
# also binding https to any ip address,
|
||||
# the port 443, and the host header www.domain.com
|
||||
iis_site 'FooBar Site' do
|
||||
bindings "http/10.12.0.136:80:www.domain.com,https/*:443:www.domain.com
|
||||
path "#{node['iis']['docroot']}/testfu"
|
||||
action [:add,:start]
|
||||
end
|
||||
```
|
||||
|
||||
iis_config
|
||||
-----------
|
||||
Runs a config command on your IIS instance.
|
||||
|
||||
### Actions
|
||||
|
||||
- `:config` - Runs the configuration command
|
||||
|
||||
### Attribute Parameters
|
||||
|
||||
- `cfg_cmd` - name attribute. What ever command you would pass in after "appcmd.exe set config"
|
||||
|
||||
### Example
|
||||
|
||||
```ruby
|
||||
# Sets up logging
|
||||
iis_config "/section:system.applicationHost/sites /siteDefaults.logfile.directory:\"D:\\logs\"" do
|
||||
action :config
|
||||
end
|
||||
```
|
||||
|
||||
```ruby
|
||||
# Loads an array of commands from the node
|
||||
cfg_cmds = node['iis']['cfg_cmd']
|
||||
cfg_cmds.each do |cmd|
|
||||
iis_config "#{cmd}" do
|
||||
action :config
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
iis_pool
|
||||
---------
|
||||
Creates an application pool in IIS.
|
||||
|
||||
### Actions
|
||||
|
||||
- `:add` - add a new application pool
|
||||
- `:config` - apply configuration to an existing application pool
|
||||
- `:delete` - delete an existing application pool
|
||||
- `:start` - start a application pool
|
||||
- `:stop` - stop a application pool
|
||||
- `:restart` - restart a application pool
|
||||
- `:recycle` - recycle an application pool
|
||||
|
||||
### Attribute Parameters
|
||||
|
||||
#### Root Items
|
||||
- `pool_name` - name attribute. Specifies the name of the pool to create.
|
||||
- `runtime_version` - specifies what .NET version of the runtime to use.
|
||||
- `pipeline_mode` - specifies what pipeline mode to create the pool with, valid values are :Integrated or :Classic, the default is :Integrated
|
||||
- `no_managed_code` - allow Unmanaged Code in setting up IIS app pools is shutting down. - default is true - optional
|
||||
|
||||
#### Add Items
|
||||
- `start_mode` - Specifies the startup type for the application pool - default :OnDemand (:OnDemand, :AlwaysRunning) - optional
|
||||
- `auto_start` - When true, indicates to the World Wide Web Publishing Service (W3SVC) that the application pool should be automatically started when it is created or when IIS is started. - boolean: default true - optional
|
||||
- `queue_length` - Indicates to HTTP.sys how many requests to queue for an application pool before rejecting future requests. - default is 1000 - optional
|
||||
- `thirty_two_bit` - set the pool to run in 32 bit mode, valid values are true or false, default is false - optional
|
||||
|
||||
#### Process Model Items
|
||||
- `max_proc` - specifies the number of worker processes associated with the pool.
|
||||
- `load_user_profile` - This property is used only when a service starts in a named user account. - Default is false - optional
|
||||
- `pool_identity` - the account identity that they app pool will run as, valid values are :SpecificUser, :NetworkService, :LocalService, :LocalSystem, :ApplicationPoolIdentity
|
||||
- `pool_username` - username for the identity for the application pool
|
||||
- `pool_password` password for the identity for the application pool is started. Default is true - optional
|
||||
- `logon_type` - Specifies the logon type for the process identity. (For additional information about [logon types](http://msdn.microsoft.com/en-us/library/aa378184%28VS.85%29.aspx), see the LogonUser Function topic on Microsoft's MSDN Web site.) - Available [:LogonBatch, :LogonService] - default is :LogonBatch - optional
|
||||
- `manual_group_membership` - Specifies whether the IIS_IUSRS group Security Identifier (SID) is added to the worker process token. When false, IIS automatically uses an application pool identity as though it were a member of the built-in IIS_IUSRS group, which has access to necessary file and system resources. When true, an application pool identity must be explicitly added to all resources that a worker process requires at runtime. - default is false - optional
|
||||
- `idle_timeout` - Specifies how long (in minutes) a worker process should run idle if no new requests are received and the worker process is not processing requests. After the allocated time passes, the worker process should request that it be shut down by the WWW service. - default is '00:20:00' - optional
|
||||
- `shutdown_time_limit` - Specifies the time that the W3SVC service waits after it initiated a recycle. If the worker process does not shut down within the shutdownTimeLimit, it will be terminated by the W3SVC service. - default is '00:01:30' - optional
|
||||
- `startup_time_limit` - Specifies the time that IIS waits for an application pool to start. If the application pool does not startup within the startupTimeLimit, the worker process is terminated and the rapid-fail protection count is incremented. - default is '00:01:30' - optional
|
||||
- `pinging_enabled` - Specifies whether pinging is enabled for the worker process. - default is true - optional
|
||||
- `ping_interval` - Specifies the time between health-monitoring pings that the WWW service sends to a worker process - default is '00:00:30' - optional
|
||||
- `ping_response_time` - Specifies the time that a worker process is given to respond to a health-monitoring ping. After the time limit is exceeded, the WWW service terminates the worker process - default is '00:01:30' - optional
|
||||
|
||||
#### Recycling Items
|
||||
- `disallow_rotation_on_config_change` - The DisallowRotationOnConfigChange property specifies whether or not the World Wide Web Publishing Service (WWW Service) should rotate worker processes in an application pool when the configuration has changed. - Default is false - optional
|
||||
- `disallow_overlapping_rotation` - Specifies whether the WWW Service should start another worker process to replace the existing worker process while that process
|
||||
- `recycle_after_time` - specifies a pool to recycle at regular time intervals, d.hh:mm:ss, d optional
|
||||
- `recycle_at_time` - schedule a pool to recycle at a specific time, d.hh:mm:ss, d optional
|
||||
- `private_mem` - specifies the amount of private memory (in kilobytes) after which you want the pool to recycle
|
||||
|
||||
#### Failure Items
|
||||
- `load_balancer_capabilities` - Specifies behavior when a worker process cannot be started, such as when the request queue is full or an application pool is in rapid-fail protection. - default is :HttpLevel - optional
|
||||
- `orphan_worker_process` - Specifies whether to assign a worker process to an orphan state instead of terminating it when an application pool fails. - default is false - optional
|
||||
- `orphan_action_exe` - Specifies an executable to run when the WWW service orphans a worker process (if the orphanWorkerProcess attribute is set to true). You can use the orphanActionParams attribute to send parameters to the executable. - optional
|
||||
- `orphan_action_params` - Indicates command-line parameters for the executable named by the orphanActionExe attribute. To specify the process ID of the orphaned process, use %1%. - optional
|
||||
- `rapid_fail_protection` - Setting to true instructs the WWW service to remove from service all applications that are in an application pool - default is true - optional
|
||||
- `rapid_fail_protection_interval` - Specifies the number of minutes before the failure count for a process is reset. - default is '00:05:00' - optional
|
||||
- `rapid_fail_protection_max_crashes` - Specifies the maximum number of failures that are allowed within the number of minutes specified by the rapidFailProtectionInterval attribute. - default is 5 - optional
|
||||
- `auto_shutdown_exe` - Specifies an executable to run when the WWW service shuts down an application pool. - optional
|
||||
- `auto_shutdown_params` - Specifies command-line parameters for the executable that is specified in the autoShutdownExe attribute. - optional
|
||||
|
||||
#### CPU Items
|
||||
- `cpu_action` - Configures the action that IIS takes when a worker process exceeds its configured CPU limit. The action attribute is configured on a per-application pool basis. - Available options [:NoAction, :KillW3wp, :Throttle, :ThrottleUnderLoad] - default is :NoAction - optional
|
||||
- `cpu_limit` - Configures the maximum percentage of CPU time (in 1/1000ths of one percent) that the worker processes in an application pool are allowed to consume over a period of time as indicated by the resetInterval attribute. If the limit set by the limit attribute is exceeded, an event is written to the event log and an optional set of events can be triggered. These optional events are determined by the action attribute. - default is 0 - optional
|
||||
- `cpu_reset_interval` - Specifies the reset period (in minutes) for CPU monitoring and throttling limits on an application pool. When the number of minutes elapsed since the last process accounting reset equals the number specified by this property, IIS resets the CPU timers for both the logging and limit intervals. - default is '00:05:00' - optional
|
||||
- `cpu_smp_affinitized` - Specifies whether a particular worker process assigned to an application pool should also be assigned to a given CPU. - default is false - optional
|
||||
- `smp_processor_affinity_mask` - Specifies the hexadecimal processor mask for multi-processor computers, which indicates to which CPU the worker processes in an application pool should be bound. Before this property takes effect, the smpAffinitized attribute must be set to true for the application pool. - default is 4294967295 - optional
|
||||
- `smp_processor_affinity_mask_2` - Specifies the high-order DWORD hexadecimal processor mask for 64-bit multi-processor computers, which indicates to which CPU the worker processes in an application pool should be bound. Before this property takes effect, the smpAffinitized attribute must be set to true for the application pool. - default is 4294967295 - optional
|
||||
|
||||
### Example
|
||||
|
||||
```ruby
|
||||
# creates a new app pool
|
||||
iis_pool 'myAppPool_v1_1' do
|
||||
runtime_version "2.0"
|
||||
pipeline_mode :Classic
|
||||
action :add
|
||||
end
|
||||
```
|
||||
|
||||
iis_app
|
||||
--------
|
||||
|
||||
Creates an application in IIS.
|
||||
|
||||
### Actions
|
||||
|
||||
- `:add` - add a new application pool
|
||||
- `:delete` - delete an existing application pool
|
||||
|
||||
### Attribute Parameters
|
||||
|
||||
- `site_name` - name attribute. The name of the site to add this app to
|
||||
- `path` -The virtual path for this application
|
||||
- `application_pool` - The pool this application belongs to
|
||||
- `physical_path` - The physical path where this app resides.
|
||||
- `enabled_protocols` - The enabled protocols that this app provides (http, https, net.pipe, net.tcp, etc)
|
||||
|
||||
### Example
|
||||
|
||||
```ruby
|
||||
# creates a new app
|
||||
iis_app "myApp" do
|
||||
path "/v1_1"
|
||||
application_pool "myAppPool_v1_1"
|
||||
physical_path "#{node['iis']['docroot']}/testfu/v1_1"
|
||||
enabled_protocols "http,net.pipe"
|
||||
action :add
|
||||
end
|
||||
```
|
||||
|
||||
iis_vdir
|
||||
---------
|
||||
|
||||
Allows easy management of IIS virtual directories (i.e. vdirs).
|
||||
|
||||
### Actions
|
||||
|
||||
- :add: - add a new virtual directory
|
||||
- :delete: - delete an existing virtual directory
|
||||
- :config: - configure a virtual directory
|
||||
|
||||
### Attribute Parameters
|
||||
|
||||
- `application_name`: name attribute. Specifies the name of the application attribute. This is the name of the website or application you are adding it to.
|
||||
- `path`: The virtual directory path on the site.
|
||||
- `physical_path`: The physical path of the virtual directory on the disk.
|
||||
- `username`: (optional) The username required to logon to the physical_path. If set to "" will clear username and password.
|
||||
- `password`: (optional) The password required to logon to the physical_path
|
||||
- `logon_method`: (optional, default: :ClearText) The method used to logon (:Interactive, :Batch, :Network, :ClearText). For more information on these types, see "LogonUser Function", Read more at [MSDN](http://msdn2.microsoft.com/en-us/library/aa378184.aspx)
|
||||
- `allow_sub_dir_config`: (optional, default: true) Boolean that specifies whether or not the Web server will look for configuration files located in the subdirectories of this virtual directory. Setting this to false can improve performance on servers with very large numbers of web.config files, but doing so prevents IIS configuration from being read in subdirectories.
|
||||
|
||||
### Examples
|
||||
|
||||
```ruby
|
||||
# add a virtual directory to default application
|
||||
iis_vdir 'Default Web Site/' do
|
||||
action :add
|
||||
path '/Content/Test'
|
||||
physical_path 'C:\wwwroot\shared\test'
|
||||
end
|
||||
```
|
||||
|
||||
```ruby
|
||||
# add a virtual directory to an application under a site
|
||||
iis_vdir 'Default Web Site/my application' do
|
||||
action :add
|
||||
path '/Content/Test'
|
||||
physical_path 'C:\wwwroot\shared\test'
|
||||
end
|
||||
```
|
||||
|
||||
```ruby
|
||||
# adds a virtual directory to default application which points to a smb share. (Remember to escape the "\"'s)
|
||||
iis_vdir 'Default Web Site/' do
|
||||
action :add
|
||||
path '/Content/Test'
|
||||
physical_path '\\\\sharename\\sharefolder\\1'
|
||||
end
|
||||
```
|
||||
|
||||
```ruby
|
||||
# configure a virtual directory to have a username and password
|
||||
iis_vdir 'Default Web Site/' do
|
||||
action :config
|
||||
path '/Content/Test'
|
||||
username 'domain\myspecialuser'
|
||||
password 'myspecialpassword'
|
||||
end
|
||||
```
|
||||
|
||||
```ruby
|
||||
# delete a virtual directory from the default application
|
||||
iis_vdir 'Default Web Site/' do
|
||||
action :delete
|
||||
path '/Content/Test'
|
||||
end
|
||||
```
|
||||
|
||||
iis_section
|
||||
---------
|
||||
|
||||
Allows for the locking/unlocking of sections ([listed here](http://www.iis.net/configreference) or via the command `appcmd list config \"\" /config:* /xml`)
|
||||
|
||||
This is valuable to allow the `web.config` of an individual application/website control it's own settings.
|
||||
|
||||
### Actions
|
||||
|
||||
- `:lock`: - locks the `section` passed
|
||||
- `:unlock`: - unlocks the `section` passed
|
||||
|
||||
### Attribute Parameters
|
||||
|
||||
- `section`: The name of the section to lock.
|
||||
- `returns`: The result of the `shell_out` command.
|
||||
|
||||
### Examples
|
||||
|
||||
```ruby
|
||||
# Sets the IIS global windows authentication to be locked globally
|
||||
iis_section 'locks global configuration of windows auth' do
|
||||
section 'system.webServer/security/authentication/windowsAuthentication'
|
||||
action :lock
|
||||
end
|
||||
```
|
||||
|
||||
```ruby
|
||||
# Sets the IIS global Basic authentication to be locked globally
|
||||
iis_section 'locks global configuration of Basic auth' do
|
||||
section 'system.webServer/security/authentication/basicAuthentication'
|
||||
action :lock
|
||||
end
|
||||
```
|
||||
|
||||
```ruby
|
||||
# Sets the IIS global windows authentication to be unlocked globally
|
||||
iis_section 'unlocked web.config globally for windows auth' do
|
||||
action :unlock
|
||||
section 'system.webServer/security/authentication/windowsAuthentication'
|
||||
end
|
||||
```
|
||||
|
||||
```ruby
|
||||
# Sets the IIS global Basic authentication to be unlocked globally
|
||||
iis_section 'unlocked web.config globally for Basic auth' do
|
||||
action :unlock
|
||||
section 'system.webServer/security/authentication/basicAuthentication'
|
||||
end
|
||||
```
|
||||
|
||||
iis_module
|
||||
--------
|
||||
|
||||
Manages modules globally or on a per site basis.
|
||||
|
||||
### Actions
|
||||
|
||||
- `:add` - add a new module
|
||||
- `:delete` - delete a module
|
||||
|
||||
### Attribute Parameters
|
||||
|
||||
- `module_name` - The name of the module to add or delete
|
||||
- `type` - The type of module
|
||||
- `precondition` - precondition for module
|
||||
- `application` - The application or site to add the module to
|
||||
|
||||
### Example
|
||||
|
||||
```ruby
|
||||
# Adds a module called "My 3rd Party Module" to mySite/
|
||||
iis_module "My 3rd Party Module" do
|
||||
application "mySite/"
|
||||
precondition "bitness64"
|
||||
action :add
|
||||
end
|
||||
```
|
||||
|
||||
```ruby
|
||||
# Adds a module called "MyModule" to all IIS sites on the server
|
||||
iis_module "MyModule"
|
||||
```
|
||||
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
default
|
||||
-------
|
||||
|
||||
Installs and configures IIS 7.0/7.5/8.0 using the default configuration.
|
||||
|
||||
mod_*
|
||||
-----
|
||||
|
||||
This cookbook also contains recipes for installing individual IIS modules (extensions). These recipes can be included in a node's run_list to build the minimal desired custom IIS installation.
|
||||
|
||||
* `mod_aspnet` - installs ASP.NET runtime components
|
||||
* `mod_aspnet45` - installs ASP.NET 4.5 runtime components
|
||||
* `mod_auth_basic` - installs Basic Authentication support
|
||||
* `mod_auth_windows` - installs Windows Authentication (authenticate clients by using NTLM or Kerberos) support
|
||||
* `mod_compress_dynamic` - installs dynamic content compression support. *PLEASE NOTE* - enabling dynamic compression always gives you more efficient use of bandwidth, but if your server's processor utilization is already very high, the CPU load imposed by dynamic compression might make your site perform more slowly.
|
||||
* `mod_compress_static` - installs static content compression support
|
||||
* `mod_iis6_metabase_compat` - installs IIS 6 Metabase Compatibility component.
|
||||
* `mod_isapi` - installs ISAPI (Internet Server Application Programming Interface) extension and filter support.
|
||||
* `mod_logging` - installs and enables HTTP Logging (logging of Web site activity), Logging Tools (logging tools and scripts) and Custom Logging (log any of the HTTP request/response headers, IIS server variables, and client-side fields with simple configuration) support
|
||||
* `mod_management` - installs Web server Management Console which supports management of local and remote Web servers
|
||||
* `mod_security` - installs URL Authorization (Authorizes client access to the URLs that comprise a Web application), Request Filtering (configures rules to block selected client requests) and IP Security (allows or denies content access based on IP address or domain name) support.
|
||||
* `mod_tracing` - installs support for tracing ASP.NET applications and failed requests.
|
||||
|
||||
Note: Not every possible IIS module has a corresponding recipe. The foregoing recipes are included for convenience, but users may also place additional IIS modules that are installable as Windows features into the ``node['iis']['components']`` array.
|
||||
|
||||
License and Author
|
||||
==================
|
||||
|
||||
* Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
* Author:: Julian Dunn (<jdunn@chef.io>)
|
||||
* Author:: Justin Schuhmann (<jmschu02@gmail.com>)
|
||||
|
||||
Copyright:: 2011-2015, Chef Software, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
27
cookbooks/iis/attributes/default.rb
Normal file
27
cookbooks/iis/attributes/default.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook Name:: iis
|
||||
# Attribute:: default
|
||||
#
|
||||
# Copyright:: Copyright (c) 2011 Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
default['iis']['home'] = "#{ENV['WINDIR']}\\System32\\inetsrv"
|
||||
default['iis']['conf_dir'] = "#{ENV['WINDIR']}\\System32\\inetsrv\\config"
|
||||
default['iis']['pubroot'] = "#{ENV['SYSTEMDRIVE']}\\inetpub"
|
||||
default['iis']['docroot'] = "#{ENV['SYSTEMDRIVE']}\\inetpub\\wwwroot"
|
||||
default['iis']['log_dir'] = "#{ENV['SYSTEMDRIVE']}\\inetpub\\logs\\LogFiles"
|
||||
default['iis']['cache_dir'] = "#{ENV['SYSTEMDRIVE']}\\inetpub\\temp"
|
||||
default['iis']['components'] = []
|
||||
87
cookbooks/iis/libraries/helper.rb
Normal file
87
cookbooks/iis/libraries/helper.rb
Normal file
@@ -0,0 +1,87 @@
|
||||
#
|
||||
# Cookbook Name:: iis
|
||||
# Library:: helper
|
||||
#
|
||||
# Author:: Julian C. Dunn <jdunn@chef.io>
|
||||
#
|
||||
# Copyright 2013, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
module Opscode
|
||||
module IIS
|
||||
# Contains functions that are used throughout this cookbook
|
||||
module Helper
|
||||
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
|
||||
require 'chef/win32/version'
|
||||
end
|
||||
|
||||
require 'rexml/document'
|
||||
include REXML
|
||||
include Windows::Helper
|
||||
|
||||
def self.older_than_windows2008r2?
|
||||
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
|
||||
win_version = Chef::ReservedNames::Win32::Version.new
|
||||
win_version.windows_server_2008? ||
|
||||
win_version.windows_vista? ||
|
||||
win_version.windows_server_2003_r2? ||
|
||||
win_version.windows_home_server? ||
|
||||
win_version.windows_server_2003? ||
|
||||
win_version.windows_xp? ||
|
||||
win_version.windows_2000?
|
||||
end
|
||||
end
|
||||
|
||||
def self.older_than_windows2012?
|
||||
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
|
||||
win_version = Chef::ReservedNames::Win32::Version.new
|
||||
win_version.windows_7? ||
|
||||
win_version.windows_server_2008_r2? ||
|
||||
win_version.windows_server_2008? ||
|
||||
win_version.windows_vista? ||
|
||||
win_version.windows_server_2003_r2? ||
|
||||
win_version.windows_home_server? ||
|
||||
win_version.windows_server_2003? ||
|
||||
win_version.windows_xp? ||
|
||||
win_version.windows_2000?
|
||||
end
|
||||
end
|
||||
|
||||
def windows_cleanpath(path)
|
||||
if !defined?(Chef::Util::PathHelper.cleanpath).nil?
|
||||
path = Chef::Util::PathHelper.cleanpath(path)
|
||||
else
|
||||
path = win_friendly_path(path)
|
||||
end
|
||||
# Remove any trailing slashes to prevent them from accidentally escaping any quotes.
|
||||
path.chomp('/').chomp('\\')
|
||||
end
|
||||
|
||||
def new_value?(document, xpath, value_to_check)
|
||||
XPath.first(document, xpath).to_s != value_to_check.to_s
|
||||
end
|
||||
|
||||
def new_or_empty_value?(document, xpath, value_to_check)
|
||||
value_to_check.to_s != '' && new_value?(document, xpath, value_to_check)
|
||||
end
|
||||
|
||||
def appcmd(node)
|
||||
@appcmd ||= begin
|
||||
"#{node['iis']['home']}\\appcmd.exe"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
68
cookbooks/iis/libraries/matcher.rb
Normal file
68
cookbooks/iis/libraries/matcher.rb
Normal file
@@ -0,0 +1,68 @@
|
||||
if defined?(ChefSpec)
|
||||
|
||||
def config_iis_config(command)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:iis_config, :config, command)
|
||||
end
|
||||
|
||||
[:config, :add, :delete].each do |action|
|
||||
self.class.send(:define_method, "#{action}_iis_app", proc do |app_name|
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:iis_app, action, app_name)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
[:config].each do |action|
|
||||
self.class.send(:define_method, "#{action}_iis_lock", proc do |section|
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:iis_lock, action, section)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
[:add, :delete].each do |action|
|
||||
self.class.send(:define_method, "#{action}_iis_module", proc do |module_name|
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:iis_module, action, module_name)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
[:add, :config, :delete, :start, :stop, :restart, :recycle].each do |action|
|
||||
self.class.send(:define_method, "#{action}_iis_pool", proc do |pool_name|
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:iis_pool, action, pool_name)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
[:add, :delete, :start, :stop, :restart, :config].each do |action|
|
||||
self.class.send(:define_method, "#{action}_iis_site", proc do |site_name|
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:iis_site, action, site_name)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
[:config].each do |action|
|
||||
self.class.send(:define_method, "#{action}_iis_unlock", proc do |section|
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:iis_unlock, action, section)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
[:add, :config, :delete].each do |action|
|
||||
self.class.send(:define_method, "#{action}_iis_vdir", proc do |section|
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:iis_vdir, action, section)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
define_method = (Gem.loaded_specs['chefspec'].version < Gem::Version.new('4.1.0')) ?
|
||||
ChefSpec::Runner.method(:define_runner_method) :
|
||||
ChefSpec.method(:define_matcher)
|
||||
|
||||
define_method.call :iis_app
|
||||
define_method.call :iis_config
|
||||
define_method.call :iis_lock
|
||||
define_method.call :iis_module
|
||||
define_method.call :iis_pool
|
||||
define_method.call :iis_site
|
||||
define_method.call :iis_unlock
|
||||
define_method.call :iis_vdir
|
||||
end
|
||||
1
cookbooks/iis/metadata.json
Normal file
1
cookbooks/iis/metadata.json
Normal file
File diff suppressed because one or more lines are too long
146
cookbooks/iis/providers/app.rb
Normal file
146
cookbooks/iis/providers/app.rb
Normal file
@@ -0,0 +1,146 @@
|
||||
#
|
||||
# Author:: Kendrick Martin (kendrick.martin@webtrends.com)
|
||||
# Contributor:: Adam Wayne (awayne@waynedigital.com)
|
||||
# Cookbook Name:: iis
|
||||
# Provider:: app
|
||||
#
|
||||
# Copyright:: 2011, Webtrends Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
require 'chef/mixin/shell_out'
|
||||
require 'rexml/document'
|
||||
|
||||
include Chef::Mixin::ShellOut
|
||||
include REXML
|
||||
include Opscode::IIS::Helper
|
||||
|
||||
action :add do
|
||||
if !@current_resource.exists
|
||||
cmd = "#{appcmd(node)} add app /site.name:\"#{new_resource.site_name}\""
|
||||
cmd << " /path:\"#{new_resource.path}\""
|
||||
cmd << " /applicationPool:\"#{new_resource.application_pool}\"" if new_resource.application_pool
|
||||
cmd << " /physicalPath:\"#{windows_cleanpath(new_resource.physical_path)}\"" if new_resource.physical_path
|
||||
cmd << " /enabledProtocols:\"#{new_resource.enabled_protocols}\"" if new_resource.enabled_protocols
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info('App created')
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} app already exists - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
action :config do
|
||||
was_updated = false
|
||||
cmd_current_values = "#{appcmd(node)} list app \"#{site_identifier}\" /config:* /xml"
|
||||
Chef::Log.debug(cmd_current_values)
|
||||
cmd_current_values = shell_out(cmd_current_values)
|
||||
if cmd_current_values.stderr.empty?
|
||||
xml = cmd_current_values.stdout
|
||||
doc = Document.new(xml)
|
||||
is_new_path = new_or_empty_value?(doc.root, 'APP/application/@path', new_resource.path.to_s)
|
||||
is_new_application_pool = new_or_empty_value?(doc.root, 'APP/application/@applicationPool', new_resource.application_pool.to_s)
|
||||
is_new_enabled_protocols = new_or_empty_value?(doc.root, 'APP/application/@enabledProtocols', new_resource.enabled_protocols.to_s)
|
||||
is_new_physical_path = new_or_empty_value?(doc.root, 'APP/application/virtualDirectory/@physicalPath', new_resource.physical_path.to_s)
|
||||
|
||||
# only get the beginning of the command if there is something that changeds
|
||||
cmd = "#{appcmd(node)} set app \"#{site_identifier}\"" if ((new_resource.path && is_new_path) ||
|
||||
(new_resource.application_pool && is_new_application_pool) ||
|
||||
(new_resource.enabled_protocols && is_new_enabled_protocols))
|
||||
# adds path to the cmd
|
||||
cmd << " /path:\"#{new_resource.path}\"" if new_resource.path && is_new_path
|
||||
# adds applicationPool to the cmd
|
||||
cmd << " /applicationPool:\"#{new_resource.application_pool}\"" if new_resource.application_pool && is_new_application_pool
|
||||
# adds enabledProtocols to the cmd
|
||||
cmd << " /enabledProtocols:\"#{new_resource.enabled_protocols}\"" if new_resource.enabled_protocols && is_new_enabled_protocols
|
||||
Chef::Log.debug(cmd)
|
||||
|
||||
if (cmd.nil?)
|
||||
Chef::Log.debug("#{new_resource} application - nothing to do")
|
||||
else
|
||||
shell_out!(cmd)
|
||||
was_updated = true
|
||||
end
|
||||
|
||||
if ((new_resource.path && is_new_path) ||
|
||||
(new_resource.application_pool && is_new_application_pool) ||
|
||||
(new_resource.enabled_protocols && is_new_enabled_protocols))
|
||||
was_updated = true
|
||||
end
|
||||
|
||||
if new_resource.physical_path && is_new_physical_path
|
||||
was_updated = true
|
||||
cmd = "#{appcmd(node)} set vdir /vdir.name:\"#{vdir_identifier}\""
|
||||
cmd << " /physicalPath:\"#{windows_cleanpath(new_resource.physical_path)}\""
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
end
|
||||
if was_updated
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} configured application")
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} application - nothing to do")
|
||||
end
|
||||
else
|
||||
log "Failed to run iis_app action :config, #{cmd_current_values.stderr}" do
|
||||
level :warn
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
action :delete do
|
||||
if @current_resource.exists
|
||||
shell_out!("#{appcmd(node)} delete app \"#{site_identifier}\"")
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} deleted")
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} app does not exist - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
def load_current_resource
|
||||
@current_resource = Chef::Resource::IisApp.new(new_resource.name)
|
||||
@current_resource.site_name(new_resource.site_name)
|
||||
@current_resource.path(new_resource.path)
|
||||
@current_resource.application_pool(new_resource.application_pool)
|
||||
cmd = shell_out("#{appcmd(node)} list app")
|
||||
Chef::Log.debug("#{new_resource} list app command output: #{cmd.stdout}")
|
||||
regex = /^APP\s\"#{new_resource.site_name}#{new_resource.path}\"/
|
||||
Chef::Log.debug('Running regex')
|
||||
if cmd.stderr.empty?
|
||||
result = cmd.stdout.match(regex)
|
||||
Chef::Log.debug("#{new_resource} current_resource match output:#{result}")
|
||||
if result
|
||||
@current_resource.exists = true
|
||||
else
|
||||
@current_resource.exists = false
|
||||
end
|
||||
else
|
||||
log "Failed to run iis_app action :load_current_resource, #{cmd_current_values.stderr}" do
|
||||
level :warn
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def site_identifier
|
||||
"#{new_resource.site_name}#{new_resource.path}"
|
||||
end
|
||||
|
||||
# Ensure VDIR identifier has a trailing slash
|
||||
def vdir_identifier
|
||||
site_identifier.end_with?('/') ? site_identifier : site_identifier + '/'
|
||||
end
|
||||
33
cookbooks/iis/providers/config.rb
Normal file
33
cookbooks/iis/providers/config.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# Author:: Kendrick Martin (kendrick.martin@webtrends.com)
|
||||
# Contributor:: David Dvorak (david.dvorak@webtrends.com)
|
||||
# Cookbook Name:: iis
|
||||
# Resource:: config
|
||||
#
|
||||
# Copyright:: 2011, Webtrends Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
require 'chef/mixin/shell_out'
|
||||
|
||||
include Chef::Mixin::ShellOut
|
||||
include Opscode::IIS::Helper
|
||||
|
||||
action :config do
|
||||
cmd = "#{appcmd(node)} set config #{new_resource.cfg_cmd}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd, returns: new_resource.returns)
|
||||
Chef::Log.info('IIS Config command run')
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
93
cookbooks/iis/providers/module.rb
Normal file
93
cookbooks/iis/providers/module.rb
Normal file
@@ -0,0 +1,93 @@
|
||||
#
|
||||
# Author:: Jon DeCamp (<jon.decamp@nordstrom.com>)
|
||||
# Cookbook Name:: iis
|
||||
# Provider:: site
|
||||
#
|
||||
# Copyright:: 2013, Nordstrom, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
require 'chef/mixin/shell_out'
|
||||
include Chef::Mixin::ShellOut
|
||||
include Opscode::IIS::Helper
|
||||
|
||||
# Support whyrun
|
||||
def whyrun_supported?
|
||||
true
|
||||
end
|
||||
|
||||
# appcmd syntax for adding modules
|
||||
# appcmd add module /name:string /type:string /preCondition:string
|
||||
action :add do
|
||||
if !@current_resource.exists
|
||||
converge_by("add IIS module #{new_resource.module_name}") do
|
||||
cmd = "#{appcmd(node)} add module /module.name:\"#{new_resource.module_name}\""
|
||||
|
||||
if new_resource.application
|
||||
cmd << " /app.name:\"#{new_resource.application}\""
|
||||
end
|
||||
|
||||
if new_resource.type
|
||||
cmd << " /type:\"#{new_resource.type}\""
|
||||
end
|
||||
|
||||
if new_resource.precondition
|
||||
cmd << " /preCondition:\"#{new_resource.precondition}\""
|
||||
end
|
||||
|
||||
shell_out!(cmd, returns: [0, 42])
|
||||
|
||||
Chef::Log.info("#{new_resource} added module '#{new_resource.module_name}'")
|
||||
end
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} module already exists - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
action :delete do
|
||||
if @current_resource.exists
|
||||
converge_by("delete IIS module #{new_resource.module_name}") do
|
||||
cmd = "#{appcmd(node)} delete module /module.name:\"#{new_resource.module_name}\""
|
||||
if new_resource.application
|
||||
cmd << " /app.name:\"#{new_resource.application}\""
|
||||
end
|
||||
|
||||
shell_out!(cmd, returns: [0, 42])
|
||||
end
|
||||
|
||||
Chef::Log.info("#{new_resource} deleted")
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} module does not exist - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
def load_current_resource
|
||||
@current_resource = Chef::Resource::IisModule.new(new_resource.name)
|
||||
@current_resource.module_name(new_resource.module_name)
|
||||
if new_resource.application
|
||||
cmd = shell_out("#{appcmd(node)} list module /module.name:\"#{new_resource.module_name}\" /app.name:\"#{new_resource.application}\"")
|
||||
else
|
||||
cmd = shell_out("#{appcmd(node)} list module /module.name:\"#{new_resource.module_name}\"")
|
||||
end
|
||||
|
||||
# 'MODULE "Module Name" ( type:module.type, preCondition:condition )'
|
||||
# 'MODULE "Module Name" ( native, preCondition:condition )'
|
||||
|
||||
Chef::Log.debug("#{new_resource} list module command output: #{cmd.stdout}")
|
||||
if cmd.stdout.empty?
|
||||
@current_resource.exists = false
|
||||
else
|
||||
@current_resource.exists = true
|
||||
end
|
||||
end
|
||||
287
cookbooks/iis/providers/pool.rb
Normal file
287
cookbooks/iis/providers/pool.rb
Normal file
@@ -0,0 +1,287 @@
|
||||
#
|
||||
# Author:: Kendrick Martin (kendrick.martin@webtrends.com)
|
||||
# Contributor:: David Dvorak (david.dvorak@webtrends.com)
|
||||
# Cookbook Name:: iis
|
||||
# Provider:: pool
|
||||
#
|
||||
# Copyright:: 2011, Webtrends Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
require 'chef/mixin/shell_out'
|
||||
require 'rexml/document'
|
||||
|
||||
include Chef::Mixin::ShellOut
|
||||
include REXML
|
||||
include Opscode::IIS::Helper
|
||||
|
||||
action :add do
|
||||
if !@current_resource.exists
|
||||
cmd = "#{appcmd(node)} add apppool /name:\"#{new_resource.pool_name}\""
|
||||
cmd << ' /managedRuntimeVersion:' if new_resource.runtime_version || new_resource.no_managed_code
|
||||
cmd << "v#{new_resource.runtime_version}" if new_resource.runtime_version && !new_resource.no_managed_code
|
||||
cmd << " /managedPipelineMode:#{new_resource.pipeline_mode.capitalize}" if new_resource.pipeline_mode
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
configure
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info('App pool created')
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} pool already exists - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
action :config do
|
||||
configure
|
||||
end
|
||||
|
||||
action :delete do
|
||||
if @current_resource.exists
|
||||
shell_out!("#{appcmd(node)} delete apppool \"#{site_identifier}\"")
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} deleted")
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} pool does not exist - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
action :start do
|
||||
if !@current_resource.running
|
||||
shell_out!("#{appcmd(node)} start apppool \"#{site_identifier}\"")
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} started")
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} already running - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
action :stop do
|
||||
if @current_resource.running
|
||||
shell_out!("#{appcmd(node)} stop apppool \"#{site_identifier}\"")
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} stopped")
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} already stopped - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
action :restart do
|
||||
shell_out!("#{appcmd(node)} stop APPPOOL \"#{site_identifier}\"")
|
||||
sleep 2
|
||||
shell_out!("#{appcmd(node)} start APPPOOL \"#{site_identifier}\"")
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} restarted")
|
||||
end
|
||||
|
||||
action :recycle do
|
||||
shell_out!("#{appcmd(node)} recycle APPPOOL \"#{site_identifier}\"")
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} recycled")
|
||||
end
|
||||
|
||||
def load_current_resource
|
||||
@current_resource = Chef::Resource::IisPool.new(new_resource.name)
|
||||
@current_resource.pool_name(new_resource.pool_name)
|
||||
cmd = shell_out("#{appcmd(node)} list apppool")
|
||||
# APPPOOL "DefaultAppPool" (MgdVersion:v2.0,MgdMode:Integrated,state:Started)
|
||||
Chef::Log.debug("#{new_resource} list apppool command output: #{cmd.stdout}")
|
||||
if cmd.stderr.empty?
|
||||
result = cmd.stdout.gsub(/\r\n?/, "\n") # ensure we have no carriage returns
|
||||
result = result.match(/^APPPOOL\s\"(#{new_resource.pool_name})\"\s\(MgdVersion:(.*),MgdMode:(.*),state:(.*)\)$/)
|
||||
Chef::Log.debug("#{new_resource} current_resource match output: #{result}")
|
||||
if result
|
||||
@current_resource.exists = true
|
||||
@current_resource.running = (result[4] =~ /Started/) ? true : false
|
||||
else
|
||||
@current_resource.exists = false
|
||||
@current_resource.running = false
|
||||
end
|
||||
else
|
||||
log "Failed to run iis_pool action :load_current_resource, #{cmd_current_values.stderr}" do
|
||||
level :warn
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def site_identifier
|
||||
new_resource.pool_name
|
||||
end
|
||||
|
||||
def configure
|
||||
@was_updated = false
|
||||
cmd_current_values = "#{appcmd(node)} list apppool \"#{new_resource.pool_name}\" /config:* /xml"
|
||||
Chef::Log.debug(cmd_current_values)
|
||||
cmd_current_values = shell_out(cmd_current_values)
|
||||
if cmd_current_values.stderr.empty?
|
||||
xml = cmd_current_values.stdout
|
||||
doc = Document.new(xml)
|
||||
|
||||
# root items
|
||||
is_new_managed_runtime_version = new_value?(doc.root, 'APPPOOL/@RuntimeVersion', "v#{new_resource.runtime_version}")
|
||||
is_new_pipeline_mode = new_value?(doc.root, 'APPPOOL/@PipelineMode'.capitalize, "#{new_resource.pipeline_mode}".to_s.capitalize)
|
||||
|
||||
# add items
|
||||
is_new_start_mode = new_value?(doc.root, 'APPPOOL/add/@startMode', new_resource.start_mode.to_s)
|
||||
is_new_auto_start = new_value?(doc.root, 'APPPOOL/add/@autoStart', new_resource.auto_start.to_s)
|
||||
is_new_queue_length = new_value?(doc.root, 'APPPOOL/add/@queueLength', new_resource.queue_length.to_s)
|
||||
is_new_enable_32_bit_app_on_win_64 = new_value?(doc.root, 'APPPOOL/add/@enable32BitAppOnWin64', new_resource.thirty_two_bit.to_s)
|
||||
|
||||
# processModel items
|
||||
is_new_max_processes = new_or_empty_value?(doc.root, 'APPPOOL/add/processModel/@maxProcesses', new_resource.max_proc.to_s)
|
||||
is_new_load_user_profile = new_value?(doc.root, 'APPPOOL/add/processModel/@loadUserProfile', new_resource.load_user_profile.to_s)
|
||||
is_new_identity_type = new_value?(doc.root, 'APPPOOL/add/processModel/@identityType', new_resource.pool_identity.to_s)
|
||||
is_new_user_name = new_or_empty_value?(doc.root, 'APPPOOL/add/processModel/@userName', new_resource.pool_username.to_s)
|
||||
is_new_password = new_or_empty_value?(doc.root, 'APPPOOL/add/processModel/@password', new_resource.pool_password.to_s)
|
||||
is_new_logon_type = new_value?(doc.root, 'APPPOOL/add/processModel/@logonType', new_resource.logon_type.to_s)
|
||||
is_new_manual_group_membership = new_value?(doc.root, 'APPPOOL/add/processModel/@manualGroupMembership', new_resource.manual_group_membership.to_s)
|
||||
is_new_idle_timeout = new_value?(doc.root, 'APPPOOL/add/processModel/@idleTimeout', new_resource.idle_timeout.to_s)
|
||||
is_new_shutdown_time_limit = new_value?(doc.root, 'APPPOOL/add/processModel/@shutdownTimeLimit', new_resource.shutdown_time_limit.to_s)
|
||||
is_new_startup_time_limit = new_value?(doc.root, 'APPPOOL/add/processModel/@startupTimeLimit', new_resource.startup_time_limit.to_s)
|
||||
is_new_pinging_enabled = new_value?(doc.root, 'APPPOOL/add/processModel/@pingingEnabled', new_resource.pinging_enabled.to_s)
|
||||
is_new_ping_interval = new_value?(doc.root, 'APPPOOL/add/processModel/@pingInterval', new_resource.ping_interval.to_s)
|
||||
is_new_ping_response_time = new_value?(doc.root, 'APPPOOL/add/processModel/@pingResponseTime', new_resource.ping_response_time.to_s)
|
||||
|
||||
# failure items
|
||||
is_new_load_balancer_capabilities = new_value?(doc.root, 'APPPOOL/add/failure/@loadBalancerCapabilities', new_resource.load_balancer_capabilities.to_s)
|
||||
is_new_orphan_worker_process = new_value?(doc.root, 'APPPOOL/add/failure/@orphanWorkerProcess', new_resource.orphan_worker_process.to_s)
|
||||
is_new_orphan_action_exe = new_or_empty_value?(doc.root, 'APPPOOL/add/failure/@orphanActionExe', new_resource.orphan_action_exe.to_s)
|
||||
is_new_orphan_action_params = new_or_empty_value?(doc.root, 'APPPOOL/add/failure/@orphanActionParams', new_resource.orphan_action_params.to_s)
|
||||
is_new_rapid_fail_protection = new_value?(doc.root, 'APPPOOL/add/failure/@rapidFailProtection', new_resource.rapid_fail_protection.to_s)
|
||||
is_new_rapid_fail_protection_interval = new_value?(doc.root, 'APPPOOL/add/failure/@rapidFailProtectionInterval', new_resource.rapid_fail_protection_interval.to_s)
|
||||
is_new_rapid_fail_protection_max_crashes = new_value?(doc.root, 'APPPOOL/add/failure/@rapidFailProtectionMaxCrashes', new_resource.rapid_fail_protection_max_crashes.to_s)
|
||||
is_new_auto_shutdown_exe = new_or_empty_value?(doc.root, 'APPPOOL/add/failure/@autoShutdownExe', new_resource.auto_shutdown_exe.to_s)
|
||||
is_new_auto_shutdown_params = new_or_empty_value?(doc.root, 'APPPOOL/add/failure/@autoShutdownParams', new_resource.auto_shutdown_params.to_s)
|
||||
|
||||
# recycling items
|
||||
is_new_disallow_overlapping_rotation = new_value?(doc.root, 'APPPOOL/add/recycling/@disallowOverlappingRotation', new_resource.disallow_overlapping_rotation.to_s)
|
||||
is_new_disallow_rotation_on_config_change = new_value?(doc.root, 'APPPOOL/add/recycling/@disallowRotationOnConfigChange', new_resource.disallow_rotation_on_config_change.to_s)
|
||||
is_new_recycle_after_time = new_or_empty_value?(doc.root, 'APPPOOL/add/recycling/periodicRestart/@time', new_resource.recycle_after_time.to_s)
|
||||
is_new_recycle_at_time = new_or_empty_value?(doc.root, 'APPPOOL/add/recycling/periodicRestart/schedule/add/@value', new_resource.recycle_at_time.to_s)
|
||||
is_new_private_memory = new_or_empty_value?(doc.root, 'APPPOOL/add/recycling/periodicRestart/@privateMemory', new_resource.private_mem.to_s)
|
||||
is_new_log_event_on_recycle = new_value?(doc.root, 'APPPOOL/add/recycling/@logEventOnRecycle', 'Time, Requests, Schedule, Memory, IsapiUnhealthy, OnDemand, ConfigChange, PrivateMemory')
|
||||
|
||||
# cpu items
|
||||
is_new_cpu_action = new_value?(doc.root, 'APPPOOL/add/cpu/@action', new_resource.cpu_action.to_s)
|
||||
is_new_cpu_limit = new_value?(doc.root, 'APPPOOL/add/cpu/@limit', new_resource.cpu_limit.to_s)
|
||||
is_new_cpu_smp_affinitized = new_value?(doc.root, 'APPPOOL/add/cpu/@smpAffinitized', new_resource.cpu_smp_affinitized.to_s)
|
||||
is_new_cpu_reset_interval = new_value?(doc.root, 'APPPOOL/add/cpu/@resetInterval', new_resource.cpu_reset_interval.to_s)
|
||||
is_new_smp_processor_affinity_mask = new_value?(doc.root, 'APPPOOL/add/cpu/@smpProcessorAffinityMask', new_resource.smp_processor_affinity_mask.to_s)
|
||||
is_new_smp_processor_affinity_mask_2 = new_value?(doc.root, 'APPPOOL/add/cpu/@smpProcessorAffinityMask2', new_resource.smp_processor_affinity_mask_2.to_s)
|
||||
|
||||
# Application Pool Config
|
||||
@cmd = "#{appcmd(node)} set config /section:applicationPools"
|
||||
|
||||
# root items
|
||||
configure_application_pool(is_new_auto_start, "autoStart:#{new_resource.auto_start}")
|
||||
configure_application_pool(is_new_start_mode, "startMode:#{new_resource.start_mode}")
|
||||
configure_application_pool(new_resource.runtime_version && is_new_managed_runtime_version, "managedRuntimeVersion:v#{new_resource.runtime_version}")
|
||||
configure_application_pool(new_resource.pipeline_mode && is_new_pipeline_mode, "managedPipelineMode:#{new_resource.pipeline_mode}")
|
||||
configure_application_pool(new_resource.thirty_two_bit && is_new_enable_32_bit_app_on_win_64, "enable32BitAppOnWin64:#{new_resource.thirty_two_bit}")
|
||||
configure_application_pool(new_resource.queue_length && is_new_queue_length, "queueLength:#{new_resource.queue_length}")
|
||||
|
||||
# processModel items
|
||||
configure_application_pool(new_resource.max_proc && is_new_max_processes, "processModel.maxProcesses:#{new_resource.max_proc}")
|
||||
configure_application_pool(is_new_load_user_profile, "processModel.loadUserProfile:#{new_resource.load_user_profile}")
|
||||
configure_application_pool(is_new_logon_type, "processModel.logonType:#{new_resource.logon_type}")
|
||||
configure_application_pool(is_new_manual_group_membership, "processModel.manualGroupMembership:#{new_resource.manual_group_membership}")
|
||||
configure_application_pool(is_new_idle_timeout, "processModel.idleTimeout:#{new_resource.idle_timeout}")
|
||||
configure_application_pool(is_new_shutdown_time_limit, "processModel.shutdownTimeLimit:#{new_resource.shutdown_time_limit}")
|
||||
configure_application_pool(is_new_startup_time_limit, "processModel.startupTimeLimit:#{new_resource.startup_time_limit}")
|
||||
configure_application_pool(is_new_pinging_enabled, "processModel.pingingEnabled:#{new_resource.pinging_enabled}")
|
||||
configure_application_pool(is_new_ping_interval, "processModel.pingInterval:#{new_resource.ping_interval}")
|
||||
configure_application_pool(is_new_ping_response_time, "processModel.pingResponseTime:#{new_resource.ping_response_time}")
|
||||
|
||||
# recycling items
|
||||
## Special case this collection removal for now.
|
||||
if (new_resource.recycle_at_time && is_new_recycle_at_time)
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set config /section:applicationPools \"/-[name='#{new_resource.pool_name}'].recycling.periodicRestart.schedule\""
|
||||
Chef::Log.debug(@cmd)
|
||||
shell_out!(@cmd)
|
||||
end
|
||||
configure_application_pool(new_resource.recycle_after_time && is_new_recycle_after_time, "recycling.periodicRestart.time:#{new_resource.recycle_after_time}")
|
||||
configure_application_pool(new_resource.recycle_at_time && is_new_recycle_at_time, "recycling.periodicRestart.schedule.[value='#{new_resource.recycle_at_time}']", '+')
|
||||
configure_application_pool(is_new_log_event_on_recycle, 'recycling.logEventOnRecycle:PrivateMemory,Memory,Schedule,Requests,Time,ConfigChange,OnDemand,IsapiUnhealthy')
|
||||
configure_application_pool(new_resource.private_mem && is_new_private_memory, "recycling.periodicRestart.privateMemory:#{new_resource.private_mem}")
|
||||
configure_application_pool(is_new_disallow_rotation_on_config_change, "recycling.disallowRotationOnConfigChange:#{new_resource.disallow_rotation_on_config_change}")
|
||||
configure_application_pool(is_new_disallow_overlapping_rotation, "recycling.disallowOverlappingRotation:#{new_resource.disallow_overlapping_rotation}")
|
||||
|
||||
# failure items
|
||||
configure_application_pool(is_new_load_balancer_capabilities, "failure.loadBalancerCapabilities:#{new_resource.load_balancer_capabilities}")
|
||||
configure_application_pool(is_new_orphan_worker_process, "failure.orphanWorkerProcess:#{new_resource.orphan_worker_process}")
|
||||
configure_application_pool(new_resource.orphan_action_exe && is_new_orphan_action_exe, "failure.orphanActionExe:#{new_resource.orphan_action_exe}")
|
||||
configure_application_pool(new_resource.orphan_action_params && is_new_orphan_action_params, "failure.orphanActionParams:#{new_resource.orphan_action_params}")
|
||||
configure_application_pool(is_new_rapid_fail_protection, "failure.rapidFailProtection:#{new_resource.rapid_fail_protection}")
|
||||
configure_application_pool(is_new_rapid_fail_protection_interval, "failure.rapidFailProtectionInterval:#{new_resource.rapid_fail_protection_interval}")
|
||||
configure_application_pool(is_new_rapid_fail_protection_max_crashes, "failure.rapidFailProtectionMaxCrashes:#{new_resource.rapid_fail_protection_max_crashes}")
|
||||
configure_application_pool(new_resource.auto_shutdown_exe && is_new_auto_shutdown_exe, "failure.autoShutdownExe:#{new_resource.auto_shutdown_exe}")
|
||||
configure_application_pool(new_resource.auto_shutdown_params && is_new_auto_shutdown_params, "failure.autoShutdownParams:#{new_resource.auto_shutdown_params}")
|
||||
|
||||
# cpu items
|
||||
configure_application_pool(is_new_cpu_action, "cpu.action:#{new_resource.cpu_action}")
|
||||
configure_application_pool(is_new_cpu_limit, "cpu.limit:#{new_resource.cpu_limit}")
|
||||
configure_application_pool(is_new_cpu_reset_interval, "cpu.resetInterval:#{new_resource.cpu_reset_interval}")
|
||||
configure_application_pool(is_new_cpu_smp_affinitized, "cpu.smpAffinitized:#{new_resource.cpu_smp_affinitized}")
|
||||
configure_application_pool(is_new_smp_processor_affinity_mask, "cpu.smpProcessorAffinityMask:#{new_resource.smp_processor_affinity_mask}")
|
||||
configure_application_pool(is_new_smp_processor_affinity_mask_2, "cpu.smpProcessorAffinityMask2:#{new_resource.smp_processor_affinity_mask_2}")
|
||||
|
||||
if (@cmd != "#{appcmd(node)} set config /section:applicationPools")
|
||||
Chef::Log.debug(@cmd)
|
||||
shell_out!(@cmd)
|
||||
end
|
||||
|
||||
# Application Pool Identity Settings
|
||||
if ((new_resource.pool_username && new_resource.pool_username != '') && (is_new_user_name || is_new_password))
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set config /section:applicationPools"
|
||||
cmd << " \"/[name='#{new_resource.pool_name}'].processModel.identityType:SpecificUser\""
|
||||
cmd << " \"/[name='#{new_resource.pool_name}'].processModel.userName:#{new_resource.pool_username}\""
|
||||
cmd << " \"/[name='#{new_resource.pool_name}'].processModel.password:#{new_resource.pool_password}\"" if (new_resource.pool_password && new_resource.pool_password != '' && is_new_password)
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
elsif ((new_resource.pool_username.nil? || new_resource.pool_username == '') &&
|
||||
(new_resource.pool_password.nil? || new_resource.pool_username == '') &&
|
||||
(is_new_identity_type && new_resource.pool_identity != 'SpecificUser'))
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set config /section:applicationPools"
|
||||
cmd << " \"/[name='#{new_resource.pool_name}'].processModel.identityType:#{new_resource.pool_identity}\""
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
end
|
||||
|
||||
if @was_updated
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} configured application pool")
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} application pool - nothing to do")
|
||||
end
|
||||
else
|
||||
log "Failed to run iis_pool action :config, #{cmd_current_values.stderr}" do
|
||||
level :warn
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def configure_application_pool(condition, config, add_remove = '')
|
||||
unless condition
|
||||
return
|
||||
end
|
||||
|
||||
@was_updated = true
|
||||
@cmd << " \"/#{add_remove}[name='#{new_resource.pool_name}'].#{config}\""
|
||||
end
|
||||
71
cookbooks/iis/providers/section.rb
Normal file
71
cookbooks/iis/providers/section.rb
Normal file
@@ -0,0 +1,71 @@
|
||||
#
|
||||
# Author:: Justin Schuhmann
|
||||
# Cookbook Name:: iis
|
||||
# Resource:: lock
|
||||
#
|
||||
# Copyright:: Justin Schuhmann
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
require 'chef/mixin/shell_out'
|
||||
require 'rexml/document'
|
||||
|
||||
include Chef::Mixin::ShellOut
|
||||
include REXML
|
||||
include Opscode::IIS::Helper
|
||||
|
||||
action :lock do
|
||||
@current_resource.exists = new_value?(doc.root, 'CONFIG/@overrideMode', 'Deny')
|
||||
|
||||
if !@current_resource.exists
|
||||
cmd = "#{appcmd(node)} lock config -section:\"#{new_resource.section}\" -commit:apphost"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd, returns: new_resource.returns)
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info('IIS Config command run')
|
||||
else
|
||||
Chef::Log.debug("#{new_resource.section} already locked - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
action :unlock do
|
||||
@current_resource.exists = new_value?(doc.root, 'CONFIG/@overrideMode', 'Allow')
|
||||
|
||||
if !@current_resource.exists
|
||||
cmd = "#{appcmd(node)} unlock config -section:\"#{new_resource.section}\" -commit:apphost"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd, returns: new_resource.returns)
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info('IIS Config command run')
|
||||
else
|
||||
Chef::Log.debug("#{new_resource.section} already unlocked - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
def load_current_resource
|
||||
@current_resource = Chef::Resource::IisSection.new(new_resource.section)
|
||||
@current_resource.section(new_resource.section)
|
||||
end
|
||||
|
||||
def doc
|
||||
cmd_current_values = "#{appcmd(node)} list config \"\" -section:#{new_resource.section} /config:* /xml"
|
||||
Chef::Log.debug(cmd_current_values)
|
||||
cmd_current_values = shell_out(cmd_current_values)
|
||||
if cmd_current_values.stderr.empty?
|
||||
xml = cmd_current_values.stdout
|
||||
return Document.new(xml)
|
||||
end
|
||||
|
||||
cmd_current_values.error!
|
||||
end
|
||||
221
cookbooks/iis/providers/site.rb
Normal file
221
cookbooks/iis/providers/site.rb
Normal file
@@ -0,0 +1,221 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook Name:: iis
|
||||
# Provider:: site
|
||||
#
|
||||
# Copyright:: 2011, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
require 'chef/mixin/shell_out'
|
||||
require 'rexml/document'
|
||||
|
||||
include Chef::Mixin::ShellOut
|
||||
include REXML
|
||||
include Opscode::IIS::Helper
|
||||
|
||||
action :add do
|
||||
if !@current_resource.exists
|
||||
cmd = "#{appcmd(node)} add site /name:\"#{new_resource.site_name}\""
|
||||
cmd << " /id:#{new_resource.site_id}" if new_resource.site_id
|
||||
cmd << " /physicalPath:\"#{windows_cleanpath(new_resource.path)}\"" if new_resource.path
|
||||
if new_resource.bindings
|
||||
cmd << " /bindings:\"#{new_resource.bindings}\""
|
||||
else
|
||||
cmd << " /bindings:#{new_resource.protocol}/*"
|
||||
cmd << ":#{new_resource.port}:" if new_resource.port
|
||||
cmd << new_resource.host_header if new_resource.host_header
|
||||
end
|
||||
|
||||
# support for additional options -logDir, -limits, -ftpServer, etc...
|
||||
if new_resource.options
|
||||
cmd << " #{new_resource.options}"
|
||||
end
|
||||
shell_out!(cmd, returns: [0, 42])
|
||||
|
||||
configure
|
||||
|
||||
if new_resource.application_pool
|
||||
shell_out!("#{appcmd(node)} set app \"#{new_resource.site_name}/\" /applicationPool:\"#{new_resource.application_pool}\"", returns: [0, 42])
|
||||
end
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} added new site '#{new_resource.site_name}'")
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} site already exists - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
action :config do
|
||||
configure
|
||||
end
|
||||
|
||||
action :delete do
|
||||
if @current_resource.exists
|
||||
Chef::Log.info("#{appcmd(node)} stop site /site.name:\"#{new_resource.site_name}\"")
|
||||
shell_out!("#{appcmd(node)} delete site /site.name:\"#{new_resource.site_name}\"", returns: [0, 42])
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} deleted")
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} site does not exist - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
action :start do
|
||||
if !@current_resource.running
|
||||
shell_out!("#{appcmd(node)} start site /site.name:\"#{new_resource.site_name}\"", returns: [0, 42])
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} started")
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} already running - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
action :stop do
|
||||
if @current_resource.running
|
||||
Chef::Log.info("#{appcmd(node)} stop site /site.name:\"#{new_resource.site_name}\"")
|
||||
shell_out!("#{appcmd(node)} stop site /site.name:\"#{new_resource.site_name}\"", returns: [0, 42])
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} stopped")
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} already stopped - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
action :restart do
|
||||
shell_out!("#{appcmd(node)} stop site /site.name:\"#{new_resource.site_name}\"", returns: [0, 42])
|
||||
sleep 2
|
||||
shell_out!("#{appcmd(node)} start site /site.name:\"#{new_resource.site_name}\"", returns: [0, 42])
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} restarted")
|
||||
end
|
||||
|
||||
def load_current_resource
|
||||
@current_resource = Chef::Resource::IisSite.new(new_resource.name)
|
||||
@current_resource.site_name(new_resource.site_name)
|
||||
cmd = shell_out("#{appcmd(node)} list site")
|
||||
Chef::Log.debug(appcmd(node))
|
||||
# 'SITE "Default Web Site" (id:1,bindings:http/*:80:,state:Started)'
|
||||
Chef::Log.debug("#{new_resource} list site command output: #{cmd.stdout}")
|
||||
if cmd.stderr.empty?
|
||||
result = cmd.stdout.gsub(/\r\n?/, "\n") # ensure we have no carriage returns
|
||||
result = result.match(/^SITE\s\"(#{new_resource.site_name})\"\s\(id:(.*),bindings:(.*),state:(.*)\)$/)
|
||||
Chef::Log.debug("#{new_resource} current_resource match output: #{result}")
|
||||
if result
|
||||
@current_resource.site_id(result[2].to_i)
|
||||
@current_resource.exists = true
|
||||
@current_resource.bindings(result[3])
|
||||
@current_resource.running = (result[4] =~ /Started/) ? true : false
|
||||
else
|
||||
@current_resource.exists = false
|
||||
@current_resource.running = false
|
||||
end
|
||||
else
|
||||
log "Failed to run iis_site action :config, #{cmd.stderr}" do
|
||||
level :warn
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def configure
|
||||
was_updated = false
|
||||
cmd_current_values = "#{appcmd(node)} list site \"#{new_resource.site_name}\" /config:* /xml"
|
||||
Chef::Log.debug(cmd_current_values)
|
||||
cmd_current_values = shell_out(cmd_current_values)
|
||||
if cmd_current_values.stderr.empty?
|
||||
xml = cmd_current_values.stdout
|
||||
doc = Document.new(xml)
|
||||
is_new_bindings = new_value?(doc.root, 'SITE/@bindings', new_resource.bindings.to_s)
|
||||
is_new_physical_path = new_or_empty_value?(doc.root, 'SITE/site/application/virtualDirectory/@physicalPath', new_resource.path.to_s)
|
||||
is_new_port_host_provided = !"#{XPath.first(doc.root, 'SITE/@bindings')},".include?("#{new_resource.protocol}/*:#{new_resource.port}:#{new_resource.host_header},")
|
||||
is_new_site_id = new_value?(doc.root, 'SITE/site/@id', new_resource.site_id.to_s)
|
||||
is_new_log_directory = new_or_empty_value?(doc.root, 'SITE/logFiles/@directory', new_resource.log_directory.to_s)
|
||||
is_new_log_period = new_or_empty_value?(doc.root, 'SITE/logFile/@period', new_resource.log_period.to_s)
|
||||
is_new_log_trunc = new_or_empty_value?(doc.root, 'SITE/logFiles/@truncateSize', new_resource.log_truncsize.to_s)
|
||||
is_new_application_pool = new_value?(doc.root, 'SITE/site/application/@applicationPool', new_resource.application_pool)
|
||||
|
||||
if (new_resource.bindings && is_new_bindings)
|
||||
was_updated = true
|
||||
cmd = "#{appcmd(node)} set site /site.name:\"#{new_resource.site_name}\""
|
||||
cmd << " /bindings:\"#{new_resource.bindings}\""
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
elsif (((new_resource.port || new_resource.host_header || new_resource.protocol) && is_new_port_host_provided) && !new_resource.bindings)
|
||||
was_updated = true
|
||||
cmd = "#{appcmd(node)} set site \"#{new_resource.site_name}\""
|
||||
cmd << " /bindings:#{new_resource.protocol}/*:#{new_resource.port}:#{new_resource.host_header}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
|
||||
if new_resource.application_pool && is_new_application_pool
|
||||
was_updated = true
|
||||
cmd = "#{appcmd(node)} set app \"#{new_resource.site_name}/\" /applicationPool:\"#{new_resource.application_pool}\""
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd, returns: [0, 42])
|
||||
end
|
||||
|
||||
if new_resource.path && is_new_physical_path
|
||||
was_updated = true
|
||||
cmd = "#{appcmd(node)} set vdir \"#{new_resource.site_name}/\""
|
||||
cmd << " /physicalPath:\"#{windows_cleanpath(new_resource.path)}\""
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
end
|
||||
|
||||
if new_resource.site_id && is_new_site_id
|
||||
cmd = "#{appcmd(node)} set site \"#{new_resource.site_name}\""
|
||||
cmd << " /id:#{new_resource.site_id}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
|
||||
if new_resource.log_directory && is_new_log_directory
|
||||
cmd = "#{appcmd(node)} set site \"#{new_resource.site_name}\""
|
||||
cmd << " /logFile.directory:#{windows_cleanpath(new_resource.log_directory)}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
|
||||
if new_resource.log_period && is_new_log_period
|
||||
cmd = "#{appcmd(node)} set site \"#{new_resource.site_name}\""
|
||||
cmd << " /logFile.period:#{new_resource.log_period}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
|
||||
if new_resource.log_truncsize && is_new_log_trunc
|
||||
cmd = "#{appcmd(node)} set site \"#{new_resource.site_name}\""
|
||||
cmd << " /logFile.truncateSize:#{new_resource.log_truncsize}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
|
||||
if was_updated
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} configured site '#{new_resource.site_name}'")
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} site - nothing to do")
|
||||
end
|
||||
else
|
||||
log "Failed to run iis_site action :config, #{cmd_current_values.stderr}" do
|
||||
level :warn
|
||||
end
|
||||
end
|
||||
end
|
||||
155
cookbooks/iis/providers/vdir.rb
Normal file
155
cookbooks/iis/providers/vdir.rb
Normal file
@@ -0,0 +1,155 @@
|
||||
#
|
||||
# Author:: Justin Schuhmann (<jmschu02@gmail.com>)
|
||||
# Cookbook Name:: iis
|
||||
# Provider:: site
|
||||
#
|
||||
# Copyright:: Justin Schuhmann
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
require 'chef/mixin/shell_out'
|
||||
require 'rexml/document'
|
||||
|
||||
include Chef::Mixin::ShellOut
|
||||
include REXML
|
||||
include Opscode::IIS::Helper
|
||||
|
||||
action :add do
|
||||
if !@current_resource.exists
|
||||
cmd = "#{appcmd(node)} add vdir /app.name:\"#{new_resource.application_name}\""
|
||||
cmd << " /path:\"#{new_resource.path}\""
|
||||
cmd << " /physicalPath:\"#{windows_cleanpath(new_resource.physical_path)}\""
|
||||
cmd << " /userName:\"#{new_resource.username}\"" if new_resource.username
|
||||
cmd << " /password:\"#{new_resource.password}\"" if new_resource.password
|
||||
cmd << " /logonMethod:#{new_resource.logon_method}" if new_resource.logon_method
|
||||
cmd << " /allowSubDirConfig:#{new_resource.allow_sub_dir_config}" if new_resource.allow_sub_dir_config
|
||||
|
||||
Chef::Log.info(cmd)
|
||||
shell_out!(cmd, returns: [0, 42, 183])
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} added new virtual directory to application: '#{new_resource.application_name}'")
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} virtual directory already exists - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
action :config do
|
||||
was_updated = false
|
||||
cmd_current_values = "#{appcmd(node)} list vdir \"#{application_identifier}\" /config:* /xml"
|
||||
Chef::Log.debug(cmd_current_values)
|
||||
cmd_current_values = shell_out!(cmd_current_values)
|
||||
if cmd_current_values.stderr.empty?
|
||||
xml = cmd_current_values.stdout
|
||||
doc = Document.new(xml)
|
||||
is_new_physical_path = new_or_empty_value?(doc.root, 'VDIR/@physicalPath', new_resource.physical_path.to_s)
|
||||
is_new_user_name = new_or_empty_value?(doc.root, 'VDIR/virtualDirectory/@userName', new_resource.username.to_s)
|
||||
is_new_password = new_or_empty_value?(doc.root, 'VDIR/virtualDirectory/@password', new_resource.password.to_s)
|
||||
is_new_logon_method = new_or_empty_value?(doc.root, 'VDIR/virtualDirectory/@logonMethod', new_resource.logon_method.to_s)
|
||||
is_new_allow_sub_dir_config = new_or_empty_value?(doc.root, 'VDIR/virtualDirectory/@allowSubDirConfig', new_resource.allow_sub_dir_config.to_s)
|
||||
|
||||
if new_resource.physical_path && is_new_physical_path
|
||||
was_updated = true
|
||||
cmd = "#{appcmd(node)} set vdir \"#{application_identifier}\" /physicalPath:\"#{new_resource.physical_path}\""
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
end
|
||||
|
||||
if new_resource.username && is_new_user_name
|
||||
was_updated = true
|
||||
cmd = "#{appcmd(node)} set vdir \"#{application_identifier}\" /userName:\"#{new_resource.username}\""
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
end
|
||||
|
||||
if new_resource.password && is_new_password
|
||||
was_updated = true
|
||||
cmd = "#{appcmd(node)} set vdir \"#{application_identifier}\" /password:\"#{new_resource.password}\""
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
end
|
||||
|
||||
if new_resource.logon_method && is_new_logon_method
|
||||
was_updated = true
|
||||
cmd = "#{appcmd(node)} set vdir \"#{application_identifier}\" /logonMethod:#{new_resource.logon_method}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
end
|
||||
|
||||
if new_resource.allow_sub_dir_config && is_new_allow_sub_dir_config
|
||||
was_updated = true
|
||||
cmd = "#{appcmd(node)} set vdir \"#{application_identifier}\" /allowSubDirConfig:#{new_resource.allow_sub_dir_config}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
end
|
||||
|
||||
if was_updated
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} configured virtual directory to application: '#{new_resource.application_name}'")
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} virtual directory - nothing to do")
|
||||
end
|
||||
else
|
||||
log "Failed to run iis_vdir action :config, #{cmd_current_values.stderr}" do
|
||||
level :warn
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
action :delete do
|
||||
if @current_resource.exists
|
||||
shell_out!("#{appcmd(node)} delete vdir \"#{application_identifier}\"", returns: [0, 42])
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} deleted")
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} virtual directory does not exist - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
def load_current_resource
|
||||
@current_resource = Chef::Resource::IisVdir.new(new_resource.name)
|
||||
@current_resource.application_name(application_name_check)
|
||||
@current_resource.path(new_resource.path)
|
||||
@current_resource.physical_path(new_resource.physical_path)
|
||||
cmd = shell_out("#{ appcmd(node) } list vdir \"#{application_identifier}\"")
|
||||
Chef::Log.debug("#{ new_resource } list vdir command output: #{ cmd.stdout }")
|
||||
|
||||
if cmd.stderr.empty?
|
||||
# VDIR "Testfu Site/Content/Test"
|
||||
result = cmd.stdout.match(/^VDIR\s\"#{Regexp.escape(application_identifier)}\"/)
|
||||
Chef::Log.debug("#{ new_resource } current_resource match output: #{ result }")
|
||||
if result
|
||||
@current_resource.exists = true
|
||||
else
|
||||
@current_resource.exists = false
|
||||
end
|
||||
else
|
||||
log "Failed to run iis_vdir action :load_current_resource, #{cmd_current_values.stderr}" do
|
||||
level :warn
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def application_identifier
|
||||
new_resource.application_name.chomp('/') + new_resource.path
|
||||
end
|
||||
|
||||
def application_name_check
|
||||
if !new_resource.application_name.include?('/') && !new_resource.application_name.end_with?('/')
|
||||
new_resource.application_name("#{new_resource.application_name}/")
|
||||
elsif new_resource.application_name.chomp('/').include?('/') && new_resource.application_name.end_with?('/')
|
||||
new_resource.application_name(new_resource.application_name.chomp('/'))
|
||||
end
|
||||
end
|
||||
34
cookbooks/iis/recipes/default.rb
Normal file
34
cookbooks/iis/recipes/default.rb
Normal file
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2011, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# Always add this, so that we don't require this to be added if we want to add other components
|
||||
default = Opscode::IIS::Helper.older_than_windows2008r2? ? 'Web-Server' : 'IIS-WebServerRole'
|
||||
|
||||
(node['iis']['components'] + [default]).each do |feature|
|
||||
windows_feature feature do
|
||||
action :install
|
||||
all !Opscode::IIS::Helper.older_than_windows2012?
|
||||
end
|
||||
end
|
||||
|
||||
service 'iis' do
|
||||
service_name 'W3SVC'
|
||||
action [:enable, :start]
|
||||
end
|
||||
29
cookbooks/iis/recipes/mod_application_initialization.rb
Normal file
29
cookbooks/iis/recipes/mod_application_initialization.rb
Normal file
@@ -0,0 +1,29 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: mod_application_initialization
|
||||
#
|
||||
# Copyright 2011, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'iis'
|
||||
|
||||
if Opscode::IIS::Helper.older_than_windows2008r2?
|
||||
log 'Application Initialization module is not supported on Windows 2008 or lower, ignoring'
|
||||
else
|
||||
windows_feature 'IIS-ApplicationInit' do
|
||||
action :install
|
||||
end
|
||||
end
|
||||
34
cookbooks/iis/recipes/mod_aspnet.rb
Normal file
34
cookbooks/iis/recipes/mod_aspnet.rb
Normal file
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: mod_aspnet
|
||||
#
|
||||
# Copyright 2011, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'iis'
|
||||
include_recipe 'iis::mod_isapi'
|
||||
|
||||
if Opscode::IIS::Helper.older_than_windows2008r2?
|
||||
features = %w(NET-Framework)
|
||||
else
|
||||
features = %w(IIS-NetFxExtensibility IIS-ASPNET)
|
||||
end
|
||||
|
||||
features.each do |feature|
|
||||
windows_feature feature do
|
||||
action :install
|
||||
end
|
||||
end
|
||||
34
cookbooks/iis/recipes/mod_aspnet45.rb
Normal file
34
cookbooks/iis/recipes/mod_aspnet45.rb
Normal file
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# Author:: Blair Hamilton (<blairham@me.com>)
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: mod_aspnet45
|
||||
#
|
||||
# Copyright 2011, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'iis'
|
||||
include_recipe 'iis::mod_isapi'
|
||||
|
||||
if Opscode::IIS::Helper.older_than_windows2008r2?
|
||||
features = %w(NET-Framework)
|
||||
else
|
||||
features = %w(NetFx4Extended-ASPNET45 IIS-NetFxExtensibility45 IIS-ASPNET45)
|
||||
end
|
||||
|
||||
features.each do |feature|
|
||||
windows_feature feature do
|
||||
action :install
|
||||
end
|
||||
end
|
||||
26
cookbooks/iis/recipes/mod_auth_anonymous.rb
Normal file
26
cookbooks/iis/recipes/mod_auth_anonymous.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# Author:: Justin Schuhmann
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: mod_auth_basic
|
||||
#
|
||||
# Copyright:: Justin Schuhmann
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'iis'
|
||||
|
||||
iis_section 'unlocks anonymous authentication control in web.config' do
|
||||
section 'system.webServer/security/authentication/anonymousAuthentication'
|
||||
action :unlock
|
||||
end
|
||||
36
cookbooks/iis/recipes/mod_auth_basic.rb
Normal file
36
cookbooks/iis/recipes/mod_auth_basic.rb
Normal file
@@ -0,0 +1,36 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: mod_auth_basic
|
||||
#
|
||||
# Copyright:: Copyright (c) 2011 Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'iis'
|
||||
|
||||
if Opscode::IIS::Helper.older_than_windows2008r2?
|
||||
feature = 'Web-Basic-Auth'
|
||||
else
|
||||
feature = 'IIS-BasicAuthentication'
|
||||
end
|
||||
|
||||
windows_feature feature do
|
||||
action :install
|
||||
end
|
||||
|
||||
iis_section 'unlocks basic authentication control in web.config' do
|
||||
section 'system.webServer/security/authentication/basicAuthentication'
|
||||
action :unlock
|
||||
end
|
||||
36
cookbooks/iis/recipes/mod_auth_digest.rb
Normal file
36
cookbooks/iis/recipes/mod_auth_digest.rb
Normal file
@@ -0,0 +1,36 @@
|
||||
#
|
||||
# Author:: Justin Schuhmann
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: mod_auth_basic
|
||||
#
|
||||
# Copyright:: Justin Schuhmann
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'iis'
|
||||
|
||||
if Opscode::IIS::Helper.older_than_windows2008r2?
|
||||
feature = 'Web-Digest-Auth'
|
||||
else
|
||||
feature = 'IIS-DigestAuthentication'
|
||||
end
|
||||
|
||||
windows_feature feature do
|
||||
action :install
|
||||
end
|
||||
|
||||
iis_section 'unlocks digest authentication control in web.config' do
|
||||
section 'system.webServer/security/authentication/digestAuthentication'
|
||||
action :unlock
|
||||
end
|
||||
36
cookbooks/iis/recipes/mod_auth_windows.rb
Normal file
36
cookbooks/iis/recipes/mod_auth_windows.rb
Normal file
@@ -0,0 +1,36 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: mod_auth_windows
|
||||
#
|
||||
# Copyright 2011, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'iis'
|
||||
|
||||
if Opscode::IIS::Helper.older_than_windows2008r2?
|
||||
feature = 'Web-Windows-Auth'
|
||||
else
|
||||
feature = 'IIS-WindowsAuthentication'
|
||||
end
|
||||
|
||||
windows_feature feature do
|
||||
action :install
|
||||
end
|
||||
|
||||
iis_section 'unlocks windows authentication control in web.config' do
|
||||
section 'system.webServer/security/authentication/windowsAuthentication'
|
||||
action :unlock
|
||||
end
|
||||
31
cookbooks/iis/recipes/mod_cgi.rb
Normal file
31
cookbooks/iis/recipes/mod_cgi.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# Author:: Richard Downer (<richard.downer@cloudsoftcorp.com>)
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: mod_cgi
|
||||
#
|
||||
# Copyright 2013, Cloudsoft Corporation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'iis'
|
||||
|
||||
if Opscode::IIS::Helper.older_than_windows2008r2?
|
||||
feature = 'Web-CGI'
|
||||
else
|
||||
feature = 'IIS-CGI'
|
||||
end
|
||||
|
||||
windows_feature feature do
|
||||
action :install
|
||||
end
|
||||
31
cookbooks/iis/recipes/mod_compress_dynamic.rb
Normal file
31
cookbooks/iis/recipes/mod_compress_dynamic.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: mod_compress_dynamic
|
||||
#
|
||||
# Copyright 2011, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'iis'
|
||||
|
||||
if Opscode::IIS::Helper.older_than_windows2008r2?
|
||||
feature = 'Web-Dyn-Compression'
|
||||
else
|
||||
feature = 'IIS-HttpCompressionDynamic'
|
||||
end
|
||||
|
||||
windows_feature feature do
|
||||
action :install
|
||||
end
|
||||
31
cookbooks/iis/recipes/mod_compress_static.rb
Normal file
31
cookbooks/iis/recipes/mod_compress_static.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: mod_compress_static
|
||||
#
|
||||
# Copyright 2011, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'iis'
|
||||
|
||||
if Opscode::IIS::Helper.older_than_windows2008r2?
|
||||
feature = 'Web-Stat-Compression'
|
||||
else
|
||||
feature = 'IIS-HttpCompressionStatic'
|
||||
end
|
||||
|
||||
windows_feature feature do
|
||||
action :install
|
||||
end
|
||||
33
cookbooks/iis/recipes/mod_ftp.rb
Normal file
33
cookbooks/iis/recipes/mod_ftp.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# Author:: Kevin Rivers (<kevin@kevinrivers.com>)
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: mod_ftp
|
||||
#
|
||||
# Copyright 2014, Kevin Rivers
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'iis'
|
||||
|
||||
if Opscode::IIS::Helper.older_than_windows2008r2?
|
||||
features = %w(Web-Ftp-Server Web-Ftp-Service Web-Ftp-Ext)
|
||||
else
|
||||
features = %w(IIS-FTPServer IIS-FTPSvc IIS-FTPExtensibility)
|
||||
end
|
||||
|
||||
features.each do |f|
|
||||
windows_feature f do
|
||||
action :install
|
||||
end
|
||||
end
|
||||
33
cookbooks/iis/recipes/mod_iis6_metabase_compat.rb
Normal file
33
cookbooks/iis/recipes/mod_iis6_metabase_compat.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# Author:: Kristian Vlaardingerbroek (<kvlaardingerbroek@schubergphilis.com>)
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: mod_iis6_metabase_compat
|
||||
#
|
||||
# Copyright 2013, Schuberg Philis B.V.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'iis'
|
||||
|
||||
if Opscode::IIS::Helper.older_than_windows2008r2?
|
||||
features = %w(Web-Mgmt-Compat Web-Metabase)
|
||||
else
|
||||
features = %w(IIS-IIS6ManagementCompatibility IIS-Metabase)
|
||||
end
|
||||
|
||||
features.each do |f|
|
||||
windows_feature f do
|
||||
action :install
|
||||
end
|
||||
end
|
||||
33
cookbooks/iis/recipes/mod_isapi.rb
Normal file
33
cookbooks/iis/recipes/mod_isapi.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: mod_isapi
|
||||
#
|
||||
# Copyright 2011, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'iis'
|
||||
|
||||
if Opscode::IIS::Helper.older_than_windows2008r2?
|
||||
features = %w(Web-ISAPI-Filter Web-ISAPI-Ext)
|
||||
else
|
||||
features = %w(IIS-ISAPIFilter IIS-ISAPIExtensions)
|
||||
end
|
||||
|
||||
features.each do |feature|
|
||||
windows_feature feature do
|
||||
action :install
|
||||
end
|
||||
end
|
||||
31
cookbooks/iis/recipes/mod_logging.rb
Normal file
31
cookbooks/iis/recipes/mod_logging.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: mod_logging
|
||||
#
|
||||
# Copyright 2011, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'iis'
|
||||
|
||||
if Opscode::IIS::Helper.older_than_windows2008r2?
|
||||
feature = 'Web-Http-Logging'
|
||||
else
|
||||
feature = 'IIS-CustomLogging'
|
||||
end
|
||||
|
||||
windows_feature feature do
|
||||
action :install
|
||||
end
|
||||
33
cookbooks/iis/recipes/mod_management.rb
Normal file
33
cookbooks/iis/recipes/mod_management.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: mod_management
|
||||
#
|
||||
# Copyright 2011, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'iis'
|
||||
|
||||
if Opscode::IIS::Helper.older_than_windows2008r2?
|
||||
features = %w(Web-Mgmt-Console Web-Mgmt-Service)
|
||||
else
|
||||
features = %w(IIS-ManagementConsole IIS-ManagementService)
|
||||
end
|
||||
|
||||
features.each do |feature|
|
||||
windows_feature feature do
|
||||
action :install
|
||||
end
|
||||
end
|
||||
33
cookbooks/iis/recipes/mod_security.rb
Normal file
33
cookbooks/iis/recipes/mod_security.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: mod_security
|
||||
#
|
||||
# Copyright 2011, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'iis'
|
||||
|
||||
if Opscode::IIS::Helper.older_than_windows2008r2?
|
||||
features = %w(Web-Url-Auth Web-Filtering Web-IP-Security)
|
||||
else
|
||||
features = %w(IIS-URLAuthorization IIS-RequestFiltering IIS-IPSecurity)
|
||||
end
|
||||
|
||||
features.each do |feature|
|
||||
windows_feature feature do
|
||||
action :install
|
||||
end
|
||||
end
|
||||
31
cookbooks/iis/recipes/mod_tracing.rb
Normal file
31
cookbooks/iis/recipes/mod_tracing.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: mod_diagnostics
|
||||
#
|
||||
# Copyright 2011, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'iis'
|
||||
|
||||
if Opscode::IIS::Helper.older_than_windows2008r2?
|
||||
feature = 'Web-Http-Tracing'
|
||||
else
|
||||
feature = 'IIS-HTTPTracing'
|
||||
end
|
||||
|
||||
windows_feature feature do
|
||||
action :install
|
||||
end
|
||||
27
cookbooks/iis/recipes/remove_default_site.rb
Normal file
27
cookbooks/iis/recipes/remove_default_site.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
#
|
||||
# Author:: Kendrick Martin (<kendrick.martin@webtrends.com>)
|
||||
# Cookbook Name:: iis
|
||||
# Recipe:: remove_default_site
|
||||
#
|
||||
# Copyright 2012, Webtrends, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
iis_site 'Default Web Site' do
|
||||
action [:stop, :delete]
|
||||
end
|
||||
|
||||
iis_pool 'DefaultAppPool' do
|
||||
action [:stop, :delete]
|
||||
end
|
||||
29
cookbooks/iis/resources/app.rb
Normal file
29
cookbooks/iis/resources/app.rb
Normal file
@@ -0,0 +1,29 @@
|
||||
#
|
||||
# Author:: Kendrick Martin (kendrick.martin@webtrends.com>)
|
||||
# Cookbook Name:: iis
|
||||
# Resource:: app
|
||||
#
|
||||
# Copyright:: 2011, Webtrends Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
actions :add, :delete, :config
|
||||
default_action :add
|
||||
|
||||
attribute :site_name, kind_of: String, name_attribute: true
|
||||
attribute :path, kind_of: String, default: '/'
|
||||
attribute :application_pool, kind_of: String
|
||||
attribute :physical_path, kind_of: String
|
||||
attribute :enabled_protocols, kind_of: String
|
||||
attr_accessor :exists, :running
|
||||
25
cookbooks/iis/resources/config.rb
Normal file
25
cookbooks/iis/resources/config.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# Author:: Kendrick Martin (kendrick.martin@webtrends.com)
|
||||
# Cookbook Name:: iis
|
||||
# Resource:: config
|
||||
#
|
||||
# Copyright:: 2011, Webtrends Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
actions :config
|
||||
default_action :config
|
||||
|
||||
attribute :cfg_cmd, kind_of: String, name_attribute: true
|
||||
attribute :returns, kind_of: [Integer, Array], default: 0
|
||||
29
cookbooks/iis/resources/module.rb
Normal file
29
cookbooks/iis/resources/module.rb
Normal file
@@ -0,0 +1,29 @@
|
||||
#
|
||||
# Author:: Jon DeCamp (<jon.decamp@nordstrom.com>)
|
||||
# Cookbook Name:: iis
|
||||
# Resource:: module
|
||||
#
|
||||
# Copyright:: 2012, Nordstrom, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
actions :add, :delete
|
||||
default_action :add
|
||||
|
||||
attribute :module_name, kind_of: String, name_attribute: true
|
||||
attribute :type, kind_of: String, default: nil
|
||||
attribute :precondition, kind_of: String, default: nil
|
||||
attribute :application, kind_of: String, default: nil
|
||||
|
||||
attr_accessor :exists
|
||||
78
cookbooks/iis/resources/pool.rb
Normal file
78
cookbooks/iis/resources/pool.rb
Normal file
@@ -0,0 +1,78 @@
|
||||
#
|
||||
# Author:: Kendrick Martin (kendrick.martin@webtrends.com>)
|
||||
# Contributor:: David Dvorak (david.dvorak@webtrends.com)
|
||||
# Cookbook Name:: iis
|
||||
# Resource:: pool
|
||||
#
|
||||
# Copyright:: 2011, Webtrends Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
actions :add, :config, :delete, :start, :stop, :restart, :recycle
|
||||
default_action :add
|
||||
|
||||
# root
|
||||
attribute :pool_name, kind_of: String, name_attribute: true
|
||||
attribute :no_managed_code, kind_of: [TrueClass, FalseClass], default: false
|
||||
attribute :pipeline_mode, kind_of: Symbol, equal_to: [:Integrated, :Classic]
|
||||
attribute :runtime_version, kind_of: String
|
||||
|
||||
# add items
|
||||
attribute :start_mode, kind_of: Symbol, equal_to: [:AlwaysRunning, :OnDemand], default: :OnDemand
|
||||
attribute :auto_start, kind_of: [TrueClass, FalseClass], default: true
|
||||
attribute :queue_length, kind_of: Integer, default: 1000
|
||||
attribute :thirty_two_bit, kind_of: [TrueClass, FalseClass], default: false
|
||||
|
||||
# processModel items
|
||||
attribute :max_proc, kind_of: Integer
|
||||
attribute :load_user_profile, kind_of: [TrueClass, FalseClass], default: false
|
||||
attribute :pool_identity, kind_of: Symbol, equal_to: [:SpecificUser, :NetworkService, :LocalService, :LocalSystem, :ApplicationPoolIdentity], default: :ApplicationPoolIdentity
|
||||
attribute :pool_username, kind_of: String
|
||||
attribute :pool_password, kind_of: String
|
||||
attribute :logon_type, kind_of: Symbol, equal_to: [:LogonBatch, :LogonService], default: :LogonBatch
|
||||
attribute :manual_group_membership, kind_of: [TrueClass, FalseClass], default: false
|
||||
attribute :idle_timeout, kind_of: String, default: '00:20:00'
|
||||
attribute :shutdown_time_limit, kind_of: String, default: '00:01:30'
|
||||
attribute :startup_time_limit, kind_of: String, default: '00:01:30'
|
||||
attribute :pinging_enabled, kind_of: [TrueClass, FalseClass], default: true
|
||||
attribute :ping_interval, kind_of: String, default: '00:00:30'
|
||||
attribute :ping_response_time, kind_of: String, default: '00:01:30'
|
||||
|
||||
# recycling items
|
||||
attribute :disallow_rotation_on_config_change, kind_of: [TrueClass, FalseClass], default: false
|
||||
attribute :disallow_overlapping_rotation, kind_of: [TrueClass, FalseClass], default: false
|
||||
attribute :recycle_after_time, kind_of: String
|
||||
attribute :recycle_at_time, kind_of: String
|
||||
attribute :private_mem, kind_of: Integer
|
||||
|
||||
# failure items
|
||||
attribute :load_balancer_capabilities, kind_of: Symbol, equal_to: [:HttpLevel, :TcpLevel], default: :HttpLevel
|
||||
attribute :orphan_worker_process, kind_of: [TrueClass, FalseClass], default: false
|
||||
attribute :orphan_action_exe, kind_of: String
|
||||
attribute :orphan_action_params, kind_of: String
|
||||
attribute :rapid_fail_protection, kind_of: [TrueClass, FalseClass], default: true
|
||||
attribute :rapid_fail_protection_interval, kind_of: String, default: '00:05:00'
|
||||
attribute :rapid_fail_protection_max_crashes, kind_of: Integer, default: 5
|
||||
attribute :auto_shutdown_exe, kind_of: String
|
||||
attribute :auto_shutdown_params, kind_of: String
|
||||
|
||||
# cpu items
|
||||
attribute :cpu_action, kind_of: Symbol, equal_to: [:NoAction, :KillW3wp, :Throttle, :ThrottleUnderLoad], default: :NoAction
|
||||
attribute :cpu_limit, kind_of: Integer, default: 0
|
||||
attribute :cpu_reset_interval, kind_of: String, default: '00:05:00'
|
||||
attribute :cpu_smp_affinitized, kind_of: [TrueClass, FalseClass], default: false
|
||||
attribute :smp_processor_affinity_mask, kind_of: Bignum, default: 4_294_967_295
|
||||
attribute :smp_processor_affinity_mask_2, kind_of: Bignum, default: 4_294_967_295
|
||||
|
||||
attr_accessor :exists, :running
|
||||
27
cookbooks/iis/resources/section.rb
Normal file
27
cookbooks/iis/resources/section.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
#
|
||||
# Author:: Justin Schuhmann
|
||||
# Cookbook Name:: iis
|
||||
# Resource:: lock
|
||||
#
|
||||
# Copyright:: Justin Schuhmann
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
actions :lock, :unlock
|
||||
default_action :lock
|
||||
|
||||
attribute :section, kind_of: String
|
||||
attribute :returns, kind_of: [Integer, Array], default: 0
|
||||
|
||||
attr_accessor :exists
|
||||
37
cookbooks/iis/resources/site.rb
Normal file
37
cookbooks/iis/resources/site.rb
Normal file
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook Name:: iis
|
||||
# Resource:: site
|
||||
#
|
||||
# Copyright:: 2011, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
actions :add, :delete, :start, :stop, :restart, :config
|
||||
default_action :add
|
||||
|
||||
attribute :site_name, kind_of: String, name_attribute: true
|
||||
attribute :site_id, kind_of: Integer
|
||||
attribute :port, kind_of: Integer, default: 80
|
||||
attribute :path, kind_of: String
|
||||
attribute :protocol, kind_of: Symbol, default: :http, equal_to: [:http, :https]
|
||||
attribute :host_header, kind_of: String, default: nil
|
||||
attribute :bindings, kind_of: String, default: nil
|
||||
attribute :application_pool, kind_of: String, default: nil
|
||||
attribute :options, kind_of: String, default: ''
|
||||
attribute :log_directory, kind_of: String, default: "#{node['iis']['pubroot']}\\logs\\LogFiles"
|
||||
attribute :log_period, kind_of: Symbol, default: :Daily, equal_to: [:Daily, :Hourly, :MaxSize, :Monthly, :Weekly]
|
||||
attribute :log_truncsize, kind_of: Integer, default: 1_048_576
|
||||
|
||||
attr_accessor :exists, :running
|
||||
32
cookbooks/iis/resources/vdir.rb
Normal file
32
cookbooks/iis/resources/vdir.rb
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# Author:: Justin Schuhmann (<jmschu02@gmail.com>)
|
||||
# Cookbook Name:: iis
|
||||
# Resource:: site
|
||||
#
|
||||
# Copyright:: Justin Schuhmann
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
actions :add, :delete, :config
|
||||
default_action :add
|
||||
|
||||
attribute :application_name, kind_of: String, name_attribute: true
|
||||
attribute :path, kind_of: String
|
||||
attribute :physical_path, kind_of: String
|
||||
attribute :username, kind_of: String, default: nil
|
||||
attribute :password, kind_of: String, default: nil
|
||||
attribute :logon_method, kind_of: Symbol, default: :ClearText, equal_to: [:Interactive, :Batch, :Network, :ClearText]
|
||||
attribute :allow_sub_dir_config, kind_of: [TrueClass, FalseClass], default: true
|
||||
|
||||
attr_accessor :exists
|
||||
Reference in New Issue
Block a user