Skip to content

Instantly share code, notes, and snippets.

View charlesjohnson's full-sized avatar

Chip Johnson charlesjohnson

View GitHub Profile
@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 / 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 / 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 / config.json
Last active December 31, 2015 18:39 — forked from micgo/CentOS Berkshelf Config
~/.berkshelf/config.json
{
"vagrant": {
"vm": {
"box": "opscode-centos-6.5",
"box_url": "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5_chef-provisionerless.box",
"forward_port": {},
"network": {
"bridged": false
},
"provision": "chef_solo"
@charlesjohnson
charlesjohnson / .kitchen.local.yml
Created December 6, 2013 00:45
Docker kitchen config
---
driver_plugin: docker
driver_config:
socket: tcp://33.33.33.10:4243
use_sudo: false
# provision_command: curl -L https://www.opscode.com/chef/install.sh | bash
require_chef_omnibus: true
settings:
parallel: true
# Note: This can take as long as 15 minutes, and will show the bootstrap stuck at "waiting for winrm," but should not take more than 30.
knife ec2 server create -V -V --flavor m1.large --bootstrap-protocol winrm -I ami-173d747e --user-data ./userdata.ps1 -r "role[nopcommerce]" -x opscode -P "opscode" -N demo_nopcommerce1 --tags "Name=demo_nopcommerce1" -Z us-east-1d --distro "windows-chef-client-msi" -S charles_opscode
require 'spec_helper'
describe 'hodor' do
context 'hodor' do
it 'hodor' do
expect(hodor).to hodor(hodor)
end
end
end
template '/etc/php5/apache2/php.ini' do
source 'php.ini.erb'
cookbook 'php'
owner 'root'
group 'root'
mode '0644'
end
@charlesjohnson
charlesjohnson / Vagrantfile
Last active December 26, 2015 08:19
Vagrant.has_plugin? example
# Plugin-specific configurations
if Vagrant.has_plugin?('vagrant-cachier')
puts 'INFO: Vagrant-cachier plugin detected. Optimizing caches.'
config.cache.enable :chef
config.cache.enable :apt
else
puts 'WARN: Vagrant-cachier plugin not detected. Continuing unoptimized.'
end
if Vagrant.has_plugin?('Omnibus')
%w(apache2 ntp sshd).each do |pkg|
package pkg do
action :install
end
end