Skip to content

Instantly share code, notes, and snippets.

@sbates
sbates / testing on the bleeding edge works
Last active December 15, 2015 13:39
bleeding edges can work - there's an error at the end but it's from the chef converge as I haven't actually configured anything yet.
saschas-MacBook-Air:chef-ci sascha$ cat Gemfile
source 'https://rubygems.org'
gem 'berkshelf', '1.4.0.rc1'
gem 'test-kitchen', '1.0.0.alpha.2', :group => :integration
gem 'kitchen-vagrant', '0.7.4', :group => :integration
gem 'vagrant', '1.1.5.dev'
saschas-MacBook-Air:chef-ci sascha$ time kitchen test
-----> Starting Kitchen
saschas-MacBook-Air:cookbooks sascha$ cat Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
builder (3.2.0)
chef (11.4.0)
erubis
highline (>= 1.6.9)
json (>= 1.4.4, <= 1.7.7)
mixlib-authentication (>= 1.3.0)
************cat myfile |grep -v ^#|grep -v '#.*'|wc -l
5
************cat myfile |wc -l
85
@sbates
sbates / artifact_provider.rb
Last active October 5, 2017 14:02
a pass at an artifactory resource/provider
require 'chef/provider'
require 'restclient'
class Chef
class Provider
class Artifact < Chef::Provider
def load_current_resource
@current_resource = Chef::Resource::Artifact.new(new_resource.name)
art_user = new_resource.user
@sbates
sbates / gist:5518972
Created May 4, 2013 22:24
librarian/vagrant wtf
saschabx-mac08:sensu-lxc-demo saschabX$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'hw-ubuntu-12.10'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Installing Chef cookbooks with Librarian-Chef...
[default] Destroying VM and associated drives...
(StandardError).vagrant.d/gems/gems/librarian-0.1.0/lib/librarian/source/git/repository.rb:209:in `run_command_internal': Permission denied (publickey).
fatal: The remote end hung up unexpectedly
@sbates
sbates / gist:5519455
Created May 5, 2013 02:33
kitten cam negotiations
[5/4/13 9:24:24 PM] Sascha Bates: my kitten picture is missing
[5/4/13 9:24:46 PM] :bf: night time
[5/4/13 9:25:09 PM] Sascha Bates: but cats are nocturnal
[5/4/13 9:25:43 PM] :bf: sure
[5/4/13 9:26:11 PM] :bf: you can watch them running around in the dark
[5/4/13 9:26:55 PM] Sascha Bates: you could turn on the light
[5/4/13 9:27:06 PM] :bf: no
[5/4/13 9:27:12 PM] Sascha Bates: why not?
[5/4/13 9:27:24 PM] :bf: it's night time
[5/4/13 9:27:25 PM] Sascha Bates: but what will Isa and I do at night?
vagrant@sensu-lxc-host:~$ cd /vagrant
vagrant@sensu-lxc-host:/vagrant$ sudo vagabond up
Ensuring expected system state (creating required base containers)
  - This can take a while...
[5/4/13 10:26:08 PM] Sascha Bates: and it's hanging here
@sbates
sbates / vagabond nohup
Created May 5, 2013 04:05
this is the output from nohup sudo vagabond up --debug &
DEBUG: chef-solo -j /vagrant/.vagabond/dna.json -c /vagrant/.vagabond/solo.rb
[2013-05-05T04:03:28+00:00] INFO: *** Chef 11.4.4 ***
[2013-05-05T04:03:29+00:00] INFO: Setting the run_list to ["recipe[vagabond]"] from JSON
[2013-05-05T04:03:29+00:00] INFO: Run List is [recipe[vagabond]]
[2013-05-05T04:03:29+00:00] INFO: Run List expands to [vagabond]
[2013-05-05T04:03:29+00:00] INFO: Starting Chef Run for sensu-lxc-host
[2013-05-05T04:03:29+00:00] INFO: Running start handlers
[2013-05-05T04:03:29+00:00] INFO: Start handlers complete.
[2013-05-05T04:03:29+00:00] INFO: Processing package[lxc] action install (lxc::default line 3)
[2013-05-05T04:03:29+00:00] INFO: Processing package[yum] action install (lxc::install_dependencies line 4)
@sbates
sbates / tomcat_install.rb
Created May 12, 2013 13:15
Install Tomcat via artifactory as the package manager
#
# Cookbook Name:: tomcat
# Recipe:: install
#
# Copyright 2012
# Author:: Sascha Bates
# Contact:: sascha@brattyredhead.com
# This recipe is meant to be a common use pattern for Tomcat
# As it matures, I'll probably factor it back into a definition
# Actions: set variarbles | setup user | download tomcat | extract tomcat | set a symlink | deploy templates | define service
#
# Cookbook Name:: tomcat
# Definitions:: deploy_tomcat_app
#
# Author:: Sascha Bates
define :deploy_tomcat_app,
:artifact_type => "latest", #latest or static
:artifact => "",
:group_id => "",