Skip to content

Instantly share code, notes, and snippets.

View charlesjohnson's full-sized avatar

Charles Johnson charlesjohnson

View GitHub Profile
@charlesjohnson
charlesjohnson / Output custom_generator
Last active August 29, 2015 14:04
Trying to use custom generator cookbooks
chef generate cookbook --generator-cookbook ~/Development/custom_generator/ testcookbook
[2014-07-22T09:24:24-07:00] WARN: found a directory files in the cookbook path, but it contains no cookbook files. skipping.
[2014-07-22T09:24:24-07:00] WARN: found a directory templates in the cookbook path, but it contains no cookbook files. skipping.
Compiling Cookbooks...
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-11.14.0.rc.2/lib/chef/cookbook/cookbook_collection.rb:38:in `block in initialize': Cookbook code_generator not found. If you're loading code_generator from another cookbook, make sure you configure the dependency in your metadata (Chef::Exceptions::CookbookNotFound)
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/ohai-7.2.0.rc.2/lib/ohai/mash.rb:77:in `yield'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/ohai-7.2.0.rc.2/lib/ohai/mash.rb:77:in `default'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/ohai-7.2.0.rc.2/lib/ohai/mash.rb:77:in `default'
from /opt/chefdk/embedded/lib/ruby/gem
@charlesjohnson
charlesjohnson / test.rb
Last active August 29, 2015 14:05
Drop a gemrc and install packages to Chef's ruby context
template '/root/.gemrc' do
source 'gemrc.erb'
action :create
notifies :run, 'ruby_block[refresh_gemrc]', :immediately
end
# Thanks to http://lists.opscode.com/sympa/arc/chef/2013-12/msg00237.html
ruby_block 'refresh_gemrc' do
action :nothing
block do
@charlesjohnson
charlesjohnson / gemrc.erb
Last active August 29, 2015 14:05
Use a .gemrc file with Omnibus chef-client
:sources:
- http://<%= node['gem_file']['host'] %>:<%= node['gem_file']['port'] %>/
@charlesjohnson
charlesjohnson / Kitchen.yml driver stanza.yml
Created October 23, 2014 19:28
Use something other than omnibus to install Chef Client
---
driver:
name: vagrant
provision_command: rpm -ihv uri://to.chef.rpm
require_chef_omnibus: false
@charlesjohnson
charlesjohnson / container.rb
Created November 14, 2014 02:02
Chef Provisioning
with_driver 'docker'
machine 'web' do
from_image 'mygroup/apache_php'
end
machine 'db' do
from_image 'mygroup/mysql'
end
@charlesjohnson
charlesjohnson / Sadface
Last active August 29, 2015 14:09
Chef Provisioning Code
[2014-11-16T22:21:56-08:00] INFO: Forking chef instance to converge...
Starting Chef Client, version 11.16.4
[2014-11-16T22:21:57-08:00] INFO: *** Chef 11.16.4 ***
[2014-11-16T22:21:57-08:00] INFO: Chef-client pid: 39031
[2014-11-16T22:21:59-08:00] INFO: HTTP Request Returned 404 Not Found : Object not found: http://localhost:8889/nodes/opscode
[2014-11-16T22:21:59-08:00] INFO: Run List is []
[2014-11-16T22:21:59-08:00] INFO: Run List expands to []
[2014-11-16T22:21:59-08:00] INFO: Starting Chef Run for opscode
[2014-11-16T22:21:59-08:00] INFO: Running start handlers
[2014-11-16T22:21:59-08:00] INFO: Start handlers complete.
_________
< hi bakh >
---------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
@charlesjohnson
charlesjohnson / machine.rb
Last active August 29, 2015 14:10
Chef Provisioning snippet
# vagrant_driver.rb
require 'chef/provisioning/vagrant_driver'
vagrant_box 'chef/ubuntu-12.04'
with_machine_options :vagrant_options => {
'vm.box' => 'chef/ubuntu-12.04'
}
# Number of webservers we want
@charlesjohnson
charlesjohnson / .kitchen.yml
Created December 2, 2014 19:24
.kitchen.yml
---
driver_plugin: vagrant
driver_config:
require_chef_omnibus: true
provisioner:
name: chef_zero
platforms:
- name: centos-6.5