Skip to content

Instantly share code, notes, and snippets.

View jkeiser's full-sized avatar

John Keiser jkeiser

View GitHub Profile
@jkeiser
jkeiser / gist:4b37006506be133173d6
Created August 12, 2015 23:21
chef omnibus windows failure - angrychef?
omnibus-chef> bundle exec kitchen converge chef-windows-2008r2-standard
-----> Starting Kitchen (v1.4.1)
-----> Converging <chef-windows-2008r2-standard>...
Preparing files for transfer
Preparing dna.json
Resolving cookbook dependencies with Berkshelf 3.2.4...
Removing non-cookbook files before transfer
Preparing validation.pem
Preparing client.rb
-----> Installing Chef Omnibus (install only if missing)
# cookbooks/analytics_dev/resources/packagecloud_repository.rb
provides :packagecloud_repository
attribute :user
attribute :repo
actions :setup
# cookbooks/analytics_dev/providers/packagecloud_repository.rb
provides :packagecloud_repository
use_inline_resources
include Chef::DSL::IncludeRecipe
require 'chef/provisioning/docker_driver'
# Create the hosts
machine_batch 'docker hosts' do
machine "dockerhost1" do
recipe "docker"
attribute %w(docker host), 'tcp://localhost:5555'
end
machine "dockerhost2" do
recipe "docker"
@jkeiser
jkeiser / gist:126e7e1ed0b040ddc892
Created March 16, 2015 20:20
provisioning-machine
#
# First create a provisioners group so the ACLs are all correct
#
chef_group 'provisioners' do
end
# To be able to recreate the provisioners group
chef_acl 'groups' do
rights :create, groups: 'provisioners'
end
# To be able to add others to the provisioners group
@jkeiser
jkeiser / gist:e0fc4513882e7053d793
Created March 6, 2015 20:59
12.1.0: /opt/chef/embedded/apps/chef/lib/chef/chef_fs/file_system.rb
#
# Author:: John Keiser (<jkeiser@opscode.com>)
# Copyright:: Copyright (c) 2012 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
[2015-02-24T11:38:58-08:00] DEBUG: Initiating PUT to https://api.opscode.com/organizations/chef-provisioning/nodes/mario/_acl/read
[2015-02-24T11:38:58-08:00] DEBUG: ---- HTTP Request Header Data: ----
[2015-02-24T11:38:58-08:00] DEBUG: Content-Type: application/json
[2015-02-24T11:38:58-08:00] DEBUG: Accept: application/json
[2015-02-24T11:38:58-08:00] DEBUG: Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
[2015-02-24T11:38:58-08:00] DEBUG: X-OPS-SIGN: algorithm=sha1;version=1.0;
[2015-02-24T11:38:58-08:00] DEBUG: X-OPS-USERID: jkeiser
[2015-02-24T11:38:58-08:00] DEBUG: X-OPS-TIMESTAMP: 2015-02-24T19:38:58Z
[2015-02-24T11:38:58-08:00] DEBUG: X-OPS-CONTENT-HASH: L7bYdjfqAW5iyjDDNVwmFtQiqVQ=
[2015-02-24T11:38:58-08:00] DEBUG: X-OPS-AUTHORIZATION-1: hiRFGM9C2VbN5CWHWAX7PKWF8Q1coNqhfFG7TUmz71C8mO2XwU3xQzMQWgip
```ruby
# recipes/zones.rb
AVAILABILITY_ZONES.each do |zone|
with_driver "aws::#{zone}" do
aws_subnet "" do
end
aws_vpc "" do
end
machine_image "base_image_#{zone}" do
@jkeiser
jkeiser / metadata.rb
Last active August 29, 2015 14:13
Craztown Resource Example
name 'mycookbook'
depends 'crazytown'
class AWSRoute53RS < LWRPBase
def initialize(*args)
# parse @name
end
attribute :zone
attribute :subdomain
attribute :type
attribute :ttl
# Using the resource:
# Create/Update: this will create or update a file.
# This is a straight up "I want the file to look like this."
# It should look pretty familiar.
file '/x.txt' do
content 'hi'
end
# Read: You can use the functionality purely for reading