Permalink
Browse files

windows_tasks: initial commit

  • Loading branch information...
1 parent da45691 commit 6a8880897770c077d0d859379e43ef3e00243581 @troyready troyready committed Mar 27, 2013
Showing with 119 additions and 0 deletions.
  1. +12 −0 windows_tasks/CHANGELOG.md
  2. +66 −0 windows_tasks/README.md
  3. +8 −0 windows_tasks/metadata.rb
  4. +33 −0 windows_tasks/recipes/default.rb
View
@@ -0,0 +1,12 @@
+# CHANGELOG for windows_tasks
+
+This file is used to list changes made in each version of windows_tasks.
+
+## 0.1.0:
+
+* Initial release of windows_tasks
+
+- - -
+Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
+
+The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
View
@@ -0,0 +1,66 @@
+windows\_tasks Cookbook
+======================
+This cookbook leverages the windows\_task LWRP from Opscode's cookbook and allows you to manage Windows scheduled tasks via the nodes' attributes.
+
+Requirements
+------------
+#### cookbooks
+- `windows`
+
+Usage
+-----
+#### windows\_tasks::default
+Include `windows_tasks` in your node's `run_list`. Populate the node's \['windows'\]\['scheduled\_tasks'\] attribute with an array of hashes for each scheduled task to create/delete/modify. See the Opscode windows cookbook for an explanation of windows\_task LWRP and associated options.
+
+```json
+{
+ "name":"my_node",
+ "run_list": [
+ "recipe[windows_tasks]"
+ ],
+ "override_attributes": {
+ "windows": {
+ "scheduled_tasks": [
+ {
+ "Task name": {
+ "user": "myusername",
+ "password": "mypassword",
+ "run_level": "highest",
+ "cwd": "c:/bin",
+ "command": "c:/bin/hug_kitens.bat",
+ "frequency": "minute",
+ "frequency_modifier": 15,
+ "action": "create"
+ }
+ }
+ ]
+ }
+ }
+}
+```
+
+Contributing
+------------
+1. Fork the repository on Github
+2. Create a named feature branch (like `add\_component\_x`)
+3. Write you change
+4. Write tests for your change (if applicable)
+5. Run the tests, ensuring they all pass
+6. Submit a Pull Request using Github
+
+License and Authors
+-------------------
+ Copyright 2013, Biola University
+
+ 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.
+
@@ -0,0 +1,8 @@
+name 'windows_tasks'
+maintainer 'Biola University'
+maintainer_email 'troy.ready@biola.edu'
+license 'Apache 2.0'
+description 'Sets up Windows scheduled tasks based on node attributes'
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version '0.1.0'
+depends 'windows'
@@ -0,0 +1,33 @@
+#
+# Cookbook Name:: windows_tasks
+# Recipe:: default
+#
+# Copyright 2013, Biola University
+#
+# 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.
+#
+
+node['windows']['scheduled_tasks'].each_with_index do |parameters, index|
+ parameters.each_key do |task_name|
+ windows_task parameters.keys[0].to_s do
+ user parameters[task_name]['user'] if parameters[task_name]['user']
+ password parameters[task_name]['password'] if parameters[task_name]['password']
+ cwd parameters[task_name]['cwd'] if parameters[task_name]['cwd']
+ command parameters[task_name]['command'] if parameters[task_name]['command']
+ action parameters[task_name]['action'].to_sym if parameters[task_name]['action']
+ run_level parameters[task_name]['run_level'].to_sym if parameters[task_name]['run_level']
+ frequency parameters[task_name]['frequency'].to_sym if parameters[task_name]['frequency']
+ frequency_modifier parameters[task_name]['frequency_modifier'] if parameters[task_name]['frequency_modifier']
+ end
+ end
+end

0 comments on commit 6a88808

Please sign in to comment.