This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| # | |
| # Author:: Joshua Timberman <[email protected]> | |
| # Description:: Thor script that configures knife for a different platform. | |
| # | |
| # Copyright:: 2010, Opscode, Inc <[email protected]> | |
| # | |
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| service_link 'apache' do | |
| version [node[:apache][:version], node[:apache][:worker]].join('-') | |
| end | |
| directory "/etc/httpd" do | |
| owner "root" | |
| group "root" | |
| mode 0755 | |
| action :create | |
| not_if { File.exists?('/etc/httpd') } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alias gitp="git log -p" | |
| alias gitf="git log --pretty=format:'%Cgreen%ad %cn %Cblue%h %Creset%s' --date=short" | |
| alias gitlog="git log --graph --pretty=format:'%an: %s - %Cred%h%Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (rdb:1) eval node.attribute[:foo][:bar] = "baz" | |
| "baz" | |
| (rdb:1) eval node.attribute[:foo].has_key?(:bar) | |
| true | |
| (rdb:1) eval node.attribute[:foo].delete(:bar) | |
| "baz" | |
| (rdb:1) eval node.attribute[:foo].has_key?(:bar) | |
| false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # minimal defaults for the main postfix setup | |
| # by defaul postfix will be a null client setup | |
| # to forward to sysmail only. | |
| set[:postfix][:conf][:alias_database] = "hash:/etc/mail/aliases" | |
| set[:postfix][:conf][:alias_maps] = "hash:/etc/mail/aliases" | |
| set[:postfix][:conf][:html_directory] = "no" | |
| set[:postfix][:conf][:inet_interfaces] = "localhost" | |
| set[:postfix][:conf][:mail_owner] = "postfix" | |
| set[:postfix][:conf][:mydestination] = nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| collection.each do |r| | |
| if r.class == Chef::Resource::Package | |
| if r.action.to_s.include?("install") or r.action.to_s.include?("upgrade") | |
| r.action :upgrade | |
| elsif r.action.include?(:remove) or r.action.include?(:purge) | |
| r.action :purge | |
| end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module SmartD | |
| require "open3" | |
| # Go through the devices in node[:block_device]. | |
| def self.pop_smartd_hash() | |
| changed = false | |
| node[:block_device].each do |device, properties| | |
| if not node[:quick_start][:smartd].has_key?(device) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Chef | |
| class Resource | |
| class ManagedTemplate < Template | |
| def initialize(name, collection=nil, node=nil) | |
| super(name, collection, node) | |
| not_if { ::File.exists?(name.sub(/(.*)(\/)/, '\1/noclobber.')) } | |
| end | |
| end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Chef Client Config File | |
| require 'ohai' | |
| require 'json' | |
| o = Ohai::System.new | |
| o.all_plugins | |
| chef_config = JSON.parse(o[:ec2][:userdata]) | |
| if chef_config.kind_of?(Array) | |
| chef_config = chef_config[o[:ec2][:ami_launch_index]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sname = "recipe[#{self.cookbook_name}" + (self.recipe_name == "default" ? "" : self.recipe_name) + "]" | |
| if node.recipes[-1] != sname | |
| node.recipes.remove sname | |
| node.recipes << sname | |
| end | |
| collection.each do |r| | |
| if r.class == Chef::Resource::Package | |
| if r.action.to_s.include?("install") or r.action.to_s.include?("upgrade") | |
| t = resources(:template => "/etc/pkgsync/musthave") |