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
| require 'chef/platform' | |
| redhat_providers = Chef::Platform.platforms[:redhat][:default] | |
| Chef::Platform.platforms[:cloudlinux] = { :default => redhat_providers } |
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
| ports = node[:apache][:listen_ports].include?("443") ? node[:apache][:listen_ports] : [node[:apache][:listen_ports], "443"].flatten | |
| ports_conf = nil | |
| begin | |
| ports_conf = resources(:template => "#{node[:apache][:dir]}/ports.conf") | |
| ports_conf.ports(ports) unless ports_conf.ports.includes?("443") | |
| rescue Chef::Exceptions::ResourceNotFound | |
| template "#{node[:apache][:dir]}/ports.conf" do | |
| source "ports.conf.erb" | |
| variables :apache_listen_ports => ports |
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
| # This should be in a recipe, as early in the run list as possible | |
| begin | |
| node.override[:previous_run_list] = JSON.parse(Chef::FileCache.load("previous_run_list")) | |
| rescue Chef::Exceptions::FileNotFound | |
| Chef::Log.debug("No stored run list!") | |
| end | |
| Chef::FileCache.store("previous_run_list", node.run_list.to_json) | |
| # When you want to check if the last run list had the previous role... |
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
| begin | |
| r = resources(:file => "foo") | |
| r.source "yourfile" | |
| rescue | |
| r = file "foo" | |
| ... | |
| 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
| # Write it out | |
| File.open("/tmp/foo.json", "w") { |f| f.puts node.to_json } | |
| # Read it in | |
| JSON.parse(IO.read("/tmp/foo.json")) | |
| # Link to report handlers | |
| http://wiki.opscode.com/display/chef/Exception+and+Report+Handlers |
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::Log.level = :debug | |
| # your recipe | |
| Chef::Log.level = Chef::Config[:log_level] |
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
| run_context.resource_collection.each do |r| | |
| r.source_line =~ /cookbooks\/(.+?)\/recipes\/(.+)\.rb:.+/ | |
| cookbook_name = $1 | |
| recipe_part = $2.gsub('/', "::") | |
| recipe_name = "#{cookbook_name}::#{recipe_part}" | |
| if node[:isolation][:recipes].include?(recipe_name) || node[:isolation][:cookbooks].include?(cookbook_name) | |
| Chef::Log.info("Setting #{r.to_s} to ignore failure, via the isolation cookbook") | |
| r.ignore_failure(true) | |
| 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
| execute "update_rubygems" do | |
| notifies :restart, "service[apache2]" if node.run_list.recipes.include?("mod_passenger") | |
| 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
| default[:scout][:user] = "scout" | |
| default[:scout][:interval] = 1 | |
| #default[:scout][:group] = "scout" | |
| #default[:scout][:version] = '5.0.3' | |
| #default[:scout][:scout_bin] = "/usr/bin/scout" |
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
| 109 set backupdir=~/.vimbackup//,/tmp// | |
| 110 set directory=~/.vimswaps//,/tmp// |