mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-01 03:17:53 -05:00
31 lines
No EOL
25 KiB
JSON
31 lines
No EOL
25 KiB
JSON
{
|
|
"name": "windows",
|
|
"description": "Provides a set of useful Windows-specific primitives.",
|
|
"long_description": "Description\n===========\n\nProvides a set of Windows-specific primitives (Chef resources) meant to aid in the creation of cookbooks/recipes targeting the Windows platform.\n\nRequirements\n============\n\nVersion 1.3.0+ of this cookbook requires Chef 0.10.10+.\n\nPlatform\n--------\n\n* Windows XP\n* Windows Vista\n* Windows Server 2003 R2\n* Windows 7\n* Windows Server 2008 (R1, R2)\n\nThe `windows_task` LWRP requires Windows Server 2008 due to its API usage.\n\nCookbooks\n---------\n\nThe following cookbooks provided by Opscode are required as noted:\n\n* chef_handler (`windows::reboot_handler` leverages the chef_handler LWRP)\n* powershell - The Printer and Printer Port LWRP require Powershell.\n\n**NOTE** We cannot specifically depend on Opscode's powershell,\n because powershell depends on this cookbook. Ensure that\n `recipe[powershell]` exists in the node's expanded run list so it\n gets downloaded where the printer LWRPs are used.\n\nAttributes\n==========\n\n* `node['windows']['allow_pending_reboots']` - used to configure the `WindowsRebootHandler` (via the `windows::reboot_handler` recipe) to act on pending reboots. default is true (ie act on pending reboots). The value of this attribute only has an effect if the `windows::reboot_handler` is in a node's run list.\n\nResource/Provider\n=================\n\nwindows\\_auto\\_run\n------------------\n\n### Actions\n\n- :create: Create an item to be run at login\n- :remove: Remove an item that was previously setup to run at login\n\n### Attribute Parameters\n\n- :name: Name attribute. The name of the value to be stored in the registry\n- :program: The program to be run at login\n- :args: The arguments for the program\n\n### Examples\n\n # Run BGInfo at login\n windows_auto_run 'BGINFO' do\n program \"C:/Sysinternals/bginfo.exe\"\n args \"\\\"C:/Sysinternals/Config.bgi\\\" /NOLICPROMPT /TIMER:0\"\n not_if { Registry.value_exists?(AUTO_RUN_KEY, 'BGINFO') }\n action :create\n end\n\n\nwindows\\_batch\n--------------\n\nExecute a batch script using the cmd.exe interpreter (much like the script resources for bash, csh, powershell, perl, python and ruby). A temporary file is created and executed like other script resources, rather than run inline. By their nature, Script resources are not idempotent, as they are completely up to the user's imagination. Use the `not_if` or `only_if` meta parameters to guard the resource for idempotence.\n\n### Actions\n\n- :run: run the batch file\n\n### Attribute Parameters\n\n- command: name attribute. Name of the command to execute.\n- code: quoted string of code to execute.\n- creates: a file this command creates - if the file exists, the command will not be run.\n- cwd: current working directory to run the command from.\n- flags: command line flags to pass to the interpreter when invoking.\n- user: A user name or user ID that we should change to before running this command.\n- group: A group name or group ID that we should change to before running this command.\n\n### Examples\n\n windows_batch \"unzip_and_move_ruby\" do\n code <<-EOH\n 7z.exe x #{Chef::Config[:file_cache_path]}/ruby-1.8.7-p352-i386-mingw32.7z -oC:\\\\source -r -y\n xcopy C:\\\\source\\\\ruby-1.8.7-p352-i386-mingw32 C:\\\\ruby /e /y\n EOH\n end\n\n windows_batch \"echo some env vars\" do\n code <<-EOH\n echo %TEMP%\n echo %SYSTEMDRIVE%\n echo %PATH%\n echo %WINDIR%\n EOH\n end\n\nwindows\\_feature\n----------------\n\nWindows Roles and Features can be thought of as built-in operating system packages that ship with the OS. A server role is a set of software programs that, when they are installed and properly configured, lets a computer perform a specific function for multiple users or other computers within a network. A Role can have multiple Role Services that provide functionality to the Role. Role services are software programs that provide the functionality of a role. Features are software programs that, although they are not directly parts of roles, can support or augment the functionality of one or more roles, or improve the functionality of the server, regardless of which roles are installed. Collectively we refer to all of these attributes as 'features'.\n\nThis resource allows you to manage these 'features' in an unattended, idempotent way.\n\nThere are two providers for the `windows_features` which map into Microsoft's two major tools for managing roles/features: [Deployment Image Servicing and Management (DISM)](http://msdn.microsoft.com/en-us/library/dd371719(v=vs.85).aspx) and [Servermanagercmd](http://technet.microsoft.com/en-us/library/ee344834(WS.10).aspx) (The CLI for Server Manager). As Servermanagercmd is deprecated, Chef will set the default provider to `Chef::Provider::WindowsFeature::DISM` if DISM is present on the system being configured. The default provider will fall back to `Chef::Provider::WindowsFeature::ServerManagerCmd`.\n\nFor more information on Roles, Role Services and Features see the [Microsoft TechNet article on the topic](http://technet.microsoft.com/en-us/library/cc754923.aspx). For a complete list of all features that are available on a node type either of the following commands at a command prompt:\n\n dism /online /Get-Features\n servermanagercmd -query\n\n### Actions\n\n- :install: install a Windows role/feature\n- :remove: remove a Windows role/feature\n\n### Attribute Parameters\n\n- feature_name: name of the feature/role to install. The same feature may have different names depending on the provider used (ie DHCPServer vs DHCP; DNS-Server-Full-Role vs DNS).\n\n### Providers\n\n- **Chef::Provider::WindowsFeature::DISM**: Uses Deployment Image Servicing and Management (DISM) to manage roles/features.\n- **Chef::Provider::WindowsFeature::ServerManagerCmd**: Uses Server Manager to manage roles/features.\n\n### Examples\n\n # enable the node as a DHCP Server\n windows_feature \"DHCPServer\" do\n action :install\n end\n\n # enable TFTP\n windows_feature \"TFTP\" do\n action :install\n end\n\n # disable Telnet client/server\n %w{ TelnetServer TelnetClient }.each do |feature|\n windows_feature feature do\n action :remove\n end\n end\n\nwindows\\_package\n----------------\n\nManage Windows application packages in an unattended, idempotent way.\n\nThe following application installers are currently supported:\n\n* MSI packages\n* InstallShield\n* Wise InstallMaster\n* Inno Setup\n* Nullsoft Scriptable Install System\n\nIf the proper installer type is not passed into the resource's installer_type attribute, the provider will do it's best to identify the type by introspecting the installation package. If the installation type cannot be properly identified the `:custom` value can be passed into the installer_type attribute along with the proper flags for silent/quiet installation (using the `options` attribute..see example below).\n\n__PLEASE NOTE__ - For proper idempotence the resource's `package_name` should be the same as the 'DisplayName' registry value in the uninstallation data that is created during package installation. The easiest way to definitively find the proper 'DisplayName' value is to install the package on a machine and search for the uninstall information under the following registry keys:\n\n* `HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall`\n* `HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall`\n* `HKEY_LOCAL_MACHINE\\Software\\Wow6464Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall`\n\nFor maximum flexibility the `source` attribute supports both remote and local installation packages.\n\n### Actions\n\n- :install: install a package\n- :remove: remove a package. The remove action is completely hit or miss as many application uninstallers do not support a full silent/quiet mode.\n\n### Attribute Parameters\n\n- package_name: name attribute. The 'DisplayName' of the application installation package.\n- source: The source of the windows installer. This can either be a URI or a local path.\n- installer_type: They type of windows installation package. valid values are: :msi, :inno, :nsis, :wise, :installshield, :custom. If this value is not provided, the provider will do it's best to identify the installer type through introspection of the file.\n- checksum: useful if source is remote, the SHA-256 checksum of the file--if the local file matches the checksum, Chef will not download it\n- options: Additional options to pass the underlying installation command\n- timeout: set a timeout for the package download (default 600 seconds)\n- version: The version number of this package, as indicated by the 'DisplayVersion' value in one of the 'Uninstall' registry keys. If the given version number does equal the 'DisplayVersion' in the registry, the package will be installed.\n- success_codes: set an array of possible successful installation\n return codes. Previously this was hardcoded, but certain MSIs may\n have a different return code, e.g. 3010 for reboot required. Must be\n an array, and defaults to `[0, 42, 127]`.\n\n### Examples\n\n # install PuTTY (InnoSetup installer)\n windows_package \"PuTTY version 0.60\" do\n source \"http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.60-installer.exe\"\n installer_type :inno\n action :install\n end\n\n # install 7-Zip (MSI installer)\n windows_package \"7-Zip 9.20 (x64 edition)\" do\n source \"http://downloads.sourceforge.net/sevenzip/7z920-x64.msi\"\n action :install\n end\n\n # install Notepad++ (Y U No Emacs?) using a local installer\n windows_package \"Notepad++\" do\n source \"c:/installation_files/npp.5.9.2.Installer.exe\"\n action :install\n end\n\n # install VLC for that Xvid (NSIS installer)\n windows_package \"VLC media player 1.1.10\" do\n source \"http://superb-sea2.dl.sourceforge.net/project/vlc/1.1.10/win32/vlc-1.1.10-win32.exe\"\n action :install\n end\n\n # install Firefox as custom installer and manually set the silent install flags\n windows_package \"Mozilla Firefox 5.0 (x86 en-US)\" do\n source \"http://archive.mozilla.org/pub/mozilla.org/mozilla.org/firefox/releases/5.0/win32/en-US/Firefox%20Setup%205.0.exe\"\n options \"-ms\"\n installer_type :custom\n action :install\n end\n\n # Google Chrome FTW (MSI installer)\n windows_package \"Google Chrome\" do\n source \"https://dl-ssl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7B806F36C0-CB54-4A84-A3F3-0CF8A86575E0%7D%26lang%3Den%26browser%3D3%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dfalse/edgedl/chrome/install/GoogleChromeStandaloneEnterprise.msi\"\n action :install\n end\n\n # remove Google Chrome (but why??)\n windows_package \"Google Chrome\" do\n action :remove\n end\n\n # remove 7-Zip\n windows_package \"7-Zip 9.20 (x64 edition)\" do\n action :remove\n end\n\n\nwindows\\_printer\\_port\n----------------------\n\n**Note** Include `recipe[powershell]` on the node's expanded run list\n to ensure the powershell cookbook is downloaded to avoid circular\n dependency.\n\nCreate and delete TCP/IPv4 printer ports.\n\n### Actions\n\n- :create: Create a TCIP/IPv4 printer port. This is the default action.\n- :delete: Delete a TCIP/IPv4 printer port\n\n### Attribute Parameters\n\n- :ipv4_address: Name attribute. Required. IPv4 address, e.g. \"10.0.24.34\"\n- :port_name: Port name. Optional. Defaults to \"IP_\" + :ipv4_address\n- :port_number: Port number. Optional. Defaults to 9100.\n- :port_description: Port description. Optional.\n- :snmp_enabled: Boolean. Optional. Defaults to false.\n- :port_protocol: Port protocol, 1 (RAW), or 2 (LPR). Optional. Defaults to 1.\n\n### Examples\n\n # simplest example. Creates a TCP/IP printer port named \"IP_10.4.64.37\"\n # with all defaults\n windows_printer_port '10.4.64.37' do\n end\n\n # delete a printer port\n windows_printer_port '10.4.64.37' do\n action :delete\n end\n\n # delete a port with a custom port_name\n windows_printer_port '10.4.64.38' do\n port_name \"My awesome port\"\n action :delete\n end\n\n # Create a port with more options\n windows_printer_port '10.4.64.39' do\n port_name \"My awesome port\"\n snmp_enabled true\n port_protocol 2\n end\n\n\nwindows\\_printer\n----------------\n\n**Note** Include `recipe[powershell]` on the node's expanded run list\n to ensure the powershell cookbook is downloaded to avoid circular\n dependency.\n\nCreate Windows printer. Note that this doesn't currently install a printer\ndriver. You must already have the driver installed on the system.\n\nThe Windows Printer LWRP will automatically create a TCP/IP printer port for you using the `ipv4_address` property. If you want more granular control over the printer port, just create it using the `windows_printer_port` LWRP before creating the printer.\n\n### Actions\n\n- :create: Create a new printer\n- :delete: Delete a new printer\n\n### Attribute Parameters\n\n- :device_id: Name attribute. Required. Printer queue name, e.g. \"HP LJ 5200 in fifth floor copy room\"\n- :comment: Optional string describing the printer queue.\n- :default: Boolean. Optional. Defaults to false. Note that Windows sets the first printer defined to the default printer regardless of this setting.\n- :driver_name: String. Required. Exact name of printer driver. Note that the printer driver must already be installed on the node.\n- :location: Printer location, e.g. \"Fifth floor copy room\", or \"US/NYC/Floor42/Room4207\"\n- :shared: Boolean. Defaults to false.\n- :share_name: Printer share name.\n- :ipv4_address: Printer IPv4 address, e.g. \"10.4.64.23\". You don't have to be able to ping the IP addresss to set it. Required.\n\n\n### Examples\n\n # create a printer\n windows_printer 'HP LaserJet 5th Floor' do\n driver_name 'HP LaserJet 4100 Series PCL6'\n ipv4_address '10.4.64.38'\n end\n\n # delete a printer\n # Note: this doesn't delete the associated printer port.\n # See `windows_printer_port` above for how to delete the port.\n windows_printer 'HP LaserJet 5th Floor' do\n action :delete\n end\n\n\nwindows\\_reboot\n---------------\n\nSets required data in the node's run_state to notify `WindowsRebootHandler` a reboot is requested. If Chef run completes successfully a reboot will occur if the `WindowsRebootHandler` is properly registered as a report handler. As an action of `:request` will cause a node to reboot every Chef run, this resource is usually notified by other resources...ie restart node after a package is installed (see example below).\n\n### Actions\n\n- :request: requests a reboot at completion of successful Cher run. requires `WindowsRebootHandler` to be registered as a report handler.\n- :cancel: remove reboot request from node.run_state. this will cancel *ALL* previously requested reboots as this is a binary state.\n\n### Attribute Parameters\n\n- :timeout: Name attribute. timeout delay in seconds to wait before proceeding with the requested reboot. default is 60 seconds\n- :reason: comment on the reason for the reboot. default is 'Opscode Chef initiated reboot'\n\n### Examples\n\n # if the package installs, schedule a reboot at end of chef run\n windows_reboot 60 do\n reason 'cause chef said so'\n action :nothing\n end\n windows_package 'some_package' do\n action :install\n notifies :request, 'windows_reboot[60]'\n end\n\n # cancel the previously requested reboot\n windows_reboot 60 do\n action :cancel\n end\n\nwindows\\_registry\n-----------------\n\nCreates and modifies Windows registry keys.\n\n*Change in v1.3.0: The Win32 classes use `::Win32` to avoid namespace conflict with `Chef::Win32` (introduced in Chef 0.10.10).*\n\n### Actions\n\n- :create: create a new registry key with the provided values.\n- :modify: modify an existing registry key with the provided values.\n- :force_modify: modify an existing registry key with the provided values. ensures the value is actually set by checking multiple times. useful for fighting race conditions where two processes are trying to set the same registry key. This will be updated in the near future to use 'RegNotifyChangeKeyValue' which is exposed by the WinAPI and allows a process to register for notification on a registry key change.\n- :remove: removes a value from an existing registry key\n\n### Attribute Parameters\n\n- key_name: name attribute. The registry key to create/modify.\n- values: hash of the values to set under the registry key. The individual hash items will become respective 'Value name' => 'Value data' items in the registry key.\n- type: Type of key to create, defaults to REG_SZ. Must be a symbol, see the overview below for valid values.\n\n### Registry key types\n\n- :binary: REG_BINARY\n- :string: REG_SZ\n- :multi_string: REG_MULTI_SZ\n- :expand_string: REG_EXPAND_SZ\n- :dword: REG_DWORD\n- :dword_big_endian: REG_DWORD_BIG_ENDIAN\n- :qword: REG_QWORD\n\n### Examples\n\n # make the local windows proxy match the one set for Chef\n proxy = URI.parse(Chef::Config[:http_proxy])\n windows_registry 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings' do\n values 'ProxyEnable' => 1, 'ProxyServer' => \"#{proxy.host}:#{proxy.port}\", 'ProxyOverride' => '<local>'\n end\n\n # enable Remote Desktop and poke the firewall hole\n windows_registry 'HKLM\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server' do\n values 'FdenyTSConnections' => 0\n end\n\n # Delete an item from the registry\n windows_registry 'HKCU\\Software\\Test' do\n #Key is the name of the value that you want to delete the value is always empty\n values 'ValueToDelete' => ''\n action :remove\n end\n\n # Add a REG_MULTI_SZ value to the registry\n windows_registry 'HKCU\\Software\\Test' do\n values 'MultiString' => ['line 1', 'line 2', 'line 3']\n type :multi_string\n end\n\n### Library Methods\n\n Registry.value_exists?('HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run','BGINFO')\n Registry.key_exists?('HKLM\\SOFTWARE\\Microsoft')\n BgInfo = Registry.get_value('HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run','BGINFO')\n\nwindows\\_path\n-------------\n\n### Actions\n\n- :add: Add an item to the system path\n- :remove: Remove an item from the system path\n\n### Attribute Parameters\n\n- :path: Name attribute. The name of the value to add to the system path\n\n### Examples\n\n #Add Sysinternals to the system path\n windows_path 'C:\\Sysinternals' do\n action :add\n end\n\n #Remove 7-Zip from the system path\n windows_path 'C:\\7-Zip' do\n action :remove\n end\n\nwindows\\_task\n-------------\n\nCreates, deletes or runs a Windows scheduled task. Requires Windows\nServer 2008 due to API usage.\n\n### Actions\n\n- :create: creates a task\n- :delete: deletes a task\n- :run: runs a task\n- :change: changes the un/pw or command of a task\n\n### Attribute Parameters\n\n- name: name attribute, The task name.\n- command: The command the task will run.\n- cwd: The directory the task will be run from.\n- user: The user to run the task as. (requires password)\n- password: The user's password. (requires user)\n- run_level: Run with limited or highest privileges.\n- frequency: Frequency with which to run the task. (hourly, daily, ect.)\n- frequency_modifier: Multiple for frequency. (15 minutes, 2 days)\n\n### Examples\n\n # Run Chef every 15 minutes\n windows_task \"Chef client\" do\n user \"Administrator\"\n password \"$ecR3t\"\n cwd \"C:\\chef\\bin\"\n command \"chef-client -L C:\\tmp\\\"\n run_level :highest\n frequency :minute\n frequency_modifier 15\n end\n\n # Update Chef Client task with new password and log location\n windows_task \"Chef client\" do\n user \"Administrator\"\n password \"N3wPassW0Rd\"\n cwd \"C:\\chef\\bin\"\n command \"chef-client -L C:\\chef\\logs\\\"\n action :change\n end\n\n # Delete a taks named \"old task\"\n windows_task \"old task\" do\n action :delete\n end\n\nwindows\\_zipfile\n----------------\n\nMost version of Windows do not ship with native cli utility for managing compressed files. This resource provides a pure-ruby implementation for managing zip files. Be sure to use the `not_if` or `only_if` meta parameters to guard the resource for idempotence or action will be taken on the zip file every Chef run.\n\n### Actions\n\n- :unzip: unzip a compressed file\n\n### Attribute Parameters\n\n- path: name attribute. The path where files will be unzipped to.\n- source: The source of the zip file. This can either be a URI or a local path.\n- overwrite: force an overwrite of the files if the already exists.\n- checksum: useful if source is remote, the SHA-256 checksum of the file--if the local file matches the checksum, Chef will not download it\n\n### Examples\n\n # unzip a remote zip file locally\n windows_zipfile \"c:/bin\" do\n source \"http://download.sysinternals.com/Files/SysinternalsSuite.zip\"\n action :unzip\n not_if {::File.exists?(\"c:/bin/PsExec.exe\")}\n end\n\n # unzip a local zipfile\n windows_zipfile \"c:/the_codez\" do\n source \"c:/foo/baz/the_codez.zip\"\n action :unzip\n end\n\n\nException/Report Handlers\n=========================\n\nWindowsRebootHandler\n--------------------\n\nRequired reboots are a necessary evil of configuring and managing Windows nodes. This report handler (ie fires at the end of successful Chef runs) acts on requested (Chef initiated) or pending (as determined by the OS per configuration action we performed) reboots. The `allow_pending_reboots` initialization argument should be set to false if you do not want the handler to automatically reboot a node if it has been determined a reboot is pending. Reboots can still be requested explicitly via the `windows_reboot` LWRP.\n\n## Initialization Arguments\n\n- `allow_pending_reboots`: indicator on whether the handler should act on a the Window's 'pending reboot' state. default is true\n- `timeout`: timeout delay in seconds to wait before proceeding with the reboot. default is 60 seconds\n- `reason`: comment on the reason for the reboot. default is 'Opscode Chef initiated reboot'\n\nUsage\n=====\n\nPlace an explicit dependency on this cookbook (using depends in the cookbook's metadata.rb) from any cookbook where you would like to use the Windows-specific resources/providers that ship with this cookbook.\n\n depends \"windows\"\n\ndefault\n-------\n\nConvenience recipe that installs supporting gems for many of the resources/providers that ship with this cookbook.\n\n*Change in v1.3.0: Uses chef_gem instead of gem_package to ensure gem installation in Chef 0.10.10.*\n\nreboot\\_handler\n--------------\n\nLeverages the `chef_handler` LWRP to register the `WindowsRebootHandler` report handler that ships as part of this cookbook. By default this handler is set to automatically act on pending reboots. If you would like to change this behavior override `node['windows']['allow_pending_reboots']` and set the value to false. For example:\n\n % cat roles/base.rb\n name \"base\"\n description \"base role\"\n override_attributes(\n \"windows\" => {\n \"allow_pending_reboots\" => false\n }\n )\n\nThis will still allow a reboot to be explicitly requested via the `windows_reboot` LWRP.\n\nLicense and Author\n==================\n\nAuthor:: Seth Chisamore (<schisamo@opscode.com>)\nAuthor:: Doug MacEachern (<dougm@vmware.com>)\nAuthor:: Paul Morton (<pmorton@biaprotect.com>)\nAuthor:: Doug Ireton (<doug.ireton@nordstrom.com>)\n\nCopyright:: 2011, Opscode, Inc.\nCopyright:: 2010, VMware, Inc.\nCopyright:: 2011, Business Intelligence Associates, Inc\nCopyright:: 2012, Nordstrom, Inc.\n\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
"maintainer": "Opscode, Inc.",
|
|
"maintainer_email": "cookbooks@opscode.com",
|
|
"license": "Apache 2.0",
|
|
"platforms": {
|
|
"windows": ">= 0.0.0"
|
|
},
|
|
"dependencies": {
|
|
"chef_handler": ">= 0.0.0"
|
|
},
|
|
"recommendations": {
|
|
},
|
|
"suggestions": {
|
|
},
|
|
"conflicting": {
|
|
},
|
|
"providing": {
|
|
},
|
|
"replacing": {
|
|
},
|
|
"attributes": {
|
|
},
|
|
"groupings": {
|
|
},
|
|
"recipes": {
|
|
},
|
|
"version": "1.8.4"
|
|
} |