Skip to content

Instantly share code, notes, and snippets.

Simple, and typed nearly verbatim from:
http://wiki.opscode.com/display/chef/Recipes#Recipes-NodeAttributes
# cookbooks/ntp/recipes/default.rb
package_name = value_for_platform (
["centos", "redhat", "fedora"] => {
"default" => "ntp"
},
["solaris2"] => {
bundle agent whatever
{
vars:
"method" string => "generic";
redhat|centos::
"packagenames" slist => { "whatever" };
packages:
any::
# cfengine_stdlib.cf defines
body service_method bootstart
{
service_autostart_policy => "boot_time";
service_dependence_chain => "start_parent_services";
windows::
service_type => "windows";
}
# end cfengine_stdlib.cf snippet
@jblaine
jblaine / gist:3708198
Created September 12, 2012 17:07
RHEL6 chef server bootstrap failure
[2012-09-12T12:57:16-04:00] INFO: *** Chef 10.14.2 ***
[2012-09-12T12:57:20-04:00] INFO: Setting the run_list to ["recipe[chef-server::rubygems-install]"] from JSON
[2012-09-12T12:57:20-04:00] INFO: Run List is [recipe[chef-server::rubygems-install]]
[2012-09-12T12:57:20-04:00] INFO: Run List expands to [chef-server::rubygems-install]
[2012-09-12T12:57:20-04:00] INFO: Starting Chef Run for rcf-cm-master.mitre.org
[2012-09-12T12:57:20-04:00] INFO: Running start handlers
[2012-09-12T12:57:20-04:00] INFO: Start handlers complete.
[2012-09-12T12:57:20-04:00] INFO: Processing user[chef] action create (chef-server::rubygems-install line 30)
[2012-09-12T12:59:48-04:00] INFO: user[chef] created
[2012-09-12T12:59:48-04:00] INFO: Processing remote_file[/tmp/chef-solo/epel-release-6-7.noarch.rpm] action create (yum::epel line 38)
@jblaine
jblaine / gist:3715905
Created September 13, 2012 17:14
One-ish step RHEL6/CentOS6 Chef Server bootstrap.
#!/bin/sh
#
# One-ish step RHEL6/CentOS6 Chef Server bootstrap. Just a bunch
# of steps from the wiki encapsulated.
#
# http://wiki.opscode.com/display/chef/Installing+Chef+Server+using+Chef+Solo
#
# * Installs chef-server AND chef-webui. If you don't want the web UI,
# delete the '"webui_enabled": true' line in the code below.
# * Does not configure initial knife
How do I get the ntp cookbook's default ntp[servers] to not be used? I am
specifying my own in my role. I do not want the defaults servers + mine.
I want mine only.
rcf-chef:rcf-linux-beta> knife node show rcf-linux-beta.our.org
Node Name: rcf-linux-beta.our.org
Environment: pitt
FQDN: rcf-linux-beta.our.org
IP: 1xx.xx.11.102
Run List: role[ntpclient]
rcf-chef:rcf-linux-beta> knife cookbook site install ntp -VV
DEBUG: Using configuration from /afs/rcf/user/jblaine/.chef/knife.rb
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/knife/cookbook_site_install.rb:77:in `run': undefined method `first' for "/afs/rcf/user/jblaine/rcf-chef/cookbooks":String (NoMethodError)
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/knife.rb:408:in `run_with_pretty_exceptions'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/knife.rb:168:in `run'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/application/knife.rb:123:in `run'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/bin/knife:25:in `<top (required)>'
from /usr/bin/knife:23:in `load'
from /usr/bin/knife:23:in `<main>'
rcf-chef:rcf-linux-beta> knife --version
WORKING INPUTS --------------------------------------------------------------------------
control:
site = ( rcf )
domain = ( our.org )
access = ( root )
inform = ( on )
actionsequence = (
processes
shellcommands
2) Any non-empty line, including comment lines, in an LDIF file
MAY be folded by inserting a line separator (SEP) and a SPACE.
Folding MUST NOT occur before the first character of the line.
In other words, folding a line into two lines, the first of
which is empty, is not permitted. Any line that begins with a
single space MUST be treated as a continuation of the previous
(non-empty) line. When joining folded lines, exactly one space
character at the beginning of each continued line must be
discarded. Implementations SHOULD NOT fold lines in the middle
of a multi-byte UTF-8 character.
rcf-kerberos:rcf-linux-beta> sudo chef-solo -o "recipe[rcf-netgroups]","recipe[rcf-kerberos]" -c /afs/rcf/user/jblaine/solo.rb
[2012-10-29T17:12:23-04:00] INFO: *** Chef 10.14.2 ***
[2012-10-29T17:12:25-04:00] WARN: Run List override has been provided.
[2012-10-29T17:12:25-04:00] WARN: Original Run List: []
[2012-10-29T17:12:25-04:00] WARN: Overridden Run List: [recipe[rcf-netgroups], recipe[rcf-kerberos]]
[2012-10-29T17:12:25-04:00] INFO: Run List is [recipe[rcf-netgroups], recipe[rcf-kerberos]]
[2012-10-29T17:12:25-04:00] INFO: Run List expands to [rcf-netgroups, rcf-kerberos]
[2012-10-29T17:12:25-04:00] INFO: Starting Chef Run for rcf-linux-beta.our.org
[2012-10-29T17:12:25-04:00] INFO: Running start handlers
[2012-10-29T17:12:25-04:00] INFO: Start handlers complete.