Permalink
Browse files

add motd-tail cookbook

  • Loading branch information...
1 parent bcac604 commit 3ee742d4c43384a32d00248cbc072293901118e8 @jtimberman jtimberman committed Apr 20, 2011
Showing with 79 additions and 0 deletions.
  1. +30 −0 motd-tail/metadata.json
  2. +10 −0 motd-tail/metadata.rb
  3. +31 −0 motd-tail/recipes/default.rb
  4. +8 −0 motd-tail/templates/default/motd.tail.erb
View
30 motd-tail/metadata.json
@@ -0,0 +1,30 @@
+{
+ "name": "motd-tail",
+ "description": "Updates motd.tail with Chef Roles",
+ "long_description": "Queries Chef for the roles assigned to the node and updates motd.tail\n",
+ "maintainer": "Opscode, Inc.",
+ "maintainer_email": "cookbooks@opscode.com",
+ "license": "Apache 2.0",
+ "platforms": {
+ },
+ "dependencies": {
+ },
+ "recommendations": {
+ },
+ "suggestions": {
+ },
+ "conflicting": {
+ },
+ "providing": {
+ },
+ "replacing": {
+ },
+ "attributes": {
+ },
+ "groupings": {
+ },
+ "recipes": {
+ "motd": "Updates motd.tail with Chef Roles"
+ },
+ "version": "1.0.0"
+}
View
10 motd-tail/metadata.rb
@@ -0,0 +1,10 @@
+maintainer "Opscode, Inc."
+maintainer_email "cookbooks@opscode.com"
+license "Apache 2.0"
+description "Updates motd.tail with Chef Roles"
+long_description <<-EOH
+Queries Chef for the roles assigned to the node and updates motd.tail
+EOH
+version "1.0.0"
+recipe "motd", "Updates motd.tail with Chef Roles"
+
View
31 motd-tail/recipes/default.rb
@@ -0,0 +1,31 @@
+#
+# Author:: Nathan Haneysmith<nathan@opscode.com>
+# Cookbook Name:: motd
+# Recipe:: default
+#
+# Copyright 2009, Opscode, 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.
+#
+
+roles = node.run_list.roles
+
+template "/etc/motd.tail" do
+ source "motd.tail.erb"
+ group "root"
+ owner "root"
+ mode "0644"
+ backup 0
+ variables(:roles => roles )
+end
+
View
8 motd-tail/templates/default/motd.tail.erb
@@ -0,0 +1,8 @@
+
+***
+Chef-Client - <%= node['fqdn'] %>
+<% @roles.each do |role| -%>
+<%= role %>
+<% end -%>
+***
+

0 comments on commit 3ee742d

Please sign in to comment.