The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Original post
line = '127.0.0.1 gateway.internal gateway' | |
file = Chef::Util::FileEdit.new('/etc/hosts') | |
file.insert_line_if_no_match(/#{line}/, line) | |
file.write_file |
include_recipe "collectd" | |
class ChefCollectdPluginReportHandler < Chef::Handler | |
def report | |
Chef::Log.info('Running collectd hander') | |
node[:last_success_time] = Time.now.to_f | |
node[:error_count_since_success] = 0 | |
node.save | |
end | |
end |
include Opscode::Aws::Ec2 | |
#Auto locates and attached ebs devices based on the data bag they reside in. The following test cases need to be performed | |
# Create multiple resources with new node: PASS | |
# | |
# Re-attach multiple resources after a reboot: PASS | |
# | |
# Create resources across 2 runs. First run creates first raid set, second run re-attaches then creates: PASS | |
# |
include Chef::Mixin::Command | |
action :create do | |
size = new_resource.size | |
volumes = new_resource.volumes.times.map{|i| (i == 0 ? "/dev/sdf" : "/dev/sdf#{i}") } | |
setra = new_resource.blockdev_setra | |
volume_group = new_resource.volume_group | |
logical_volume = new_resource.name | |
mdadm_device = new_resource.mdadm_device | |
mount_point = new_resource.mount_point |
domU-12-31-39-13-D8-C1% rsyslogd -v | |
rsyslogd 5.6.2, compiled with: | |
FEATURE_REGEXP: Yes | |
FEATURE_LARGEFILE: No | |
FEATURE_NETZIP (message compression): Yes | |
GSSAPI Kerberos 5 support: No | |
FEATURE_DEBUG (debug build, slow code): No | |
Atomic operations supported: Yes | |
Runtime Instrumentation (slow code): No |
#!/usr/bin/env ruby | |
require "rubygems" | |
require "erb" | |
require "fileutils" | |
require "json" | |
require "net/ssh" | |
require "net/scp" | |
require "optparse" |
# In attribute file: | |
my_gem_packages = [ | |
"nokigiri", # Only a gem name, without a version requirement or other options" | |
["bundler", "=1.0.0"], # A gem with a version requirement | |
["rails", "~>2.3.9", "--no-ri --no-rdoc --source http://rubygems.org"], # A gem with a version requirement and options" | |
["json", nil, "--source http://rubygems.org"] # Gem with options but no version requirement | |
] | |
# In recipe: |
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: cruisecontrol.rb | |
# Required-Start: $local_fs $remote_fs | |
# Required-Stop: $local_fs $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: S 0 1 6 | |
# Short-Description: CruiseControl.rb | |
# Description: Continuous build integration system. This runs the web interface (via mongrel and the builders). | |
### END INIT INFO |
cp ~/.profile ~/.profile.bak | |
echo 'export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"' > ~/.profile | |
. ~/.profile | |
echo 'Creating src directory' | |
mkdir ~/src | |
cd ~/src | |
echo 'Installing MySQL' | |