Skip to content

Instantly share code, notes, and snippets.

View justindossey's full-sized avatar

Justin Dossey justindossey

  • Laudable Labs
  • San Francisco, CA
View GitHub Profile

Keybase proof

I hereby claim:

  • I am justindossey on github.
  • I am jbd (https://keybase.io/jbd) on keybase.
  • I have a public key ASAoh5-1psnhAkvJuhXxjUToBfwnloUfF9-Xn3SGy7eJhgo

To claim this, I am signing this object:

@justindossey
justindossey / serial.pp
Created January 4, 2017 19:52
custom fact with defined type
# Configure a serial port for IPMI (which provides virtual ones).
# Depends on the "serial_ports" custom fact, included in this module
define ipmi::serial {
include stdlib
include ipmi::serial_prerequisites
$port_exists = member($::serial_ports, "/dev/${title}")
if $port_exists {
service { $title:
@justindossey
justindossey / foo.pp
Created May 28, 2015 22:05
params and conditionals
class foo ($external_volume = true) {
if $external_volume {
notice("True!")
} else {
notice("False!")
}
}
class { 'foo':
external_volume => false,
@justindossey
justindossey / fizzbuzz.rb
Last active August 29, 2015 14:20
fizzbuzz ruby like puppet
matches = {
[true, true] => 'fizzbuzz',
[true, false] => 'fizz',
[false, true] => 'buzz'
}
(1..100).each do |num|
results = [num % 3 == 0, num % 5 == 0]
puts matches[results] || num
end
@justindossey
justindossey / foo.pp
Last active August 29, 2015 14:19
test puppet manifest
$alias_interface = ['primary:2']
if $alias_interface =~ /^primary\:(\d+)/ {
notice("Match!")
} else {
notice("No Match :(")
}
<%=
require 'yaml'
ldap_info = {
'main' => {
'label' => @label,
'host' => @host,
'port' => @port,
'uid' => @uid,
'method' => @method,
'bind_dn' => @bind_dn,
@justindossey
justindossey / example.rb
Created February 17, 2015 18:18
update resource to not start until after additional stuff added
include_recipe 'nginx'
resources(service: 'nginx').tap do |r|
r.action :enable
end
template '/etc/nginx/conf.d/my_file.conf' do
...
notifies :start, 'service[nginx]', :delayed
end
@justindossey
justindossey / gist:26784dadf02a6792204d
Created February 6, 2015 16:27
search with defaults
default_redis_ip = 'localhost'
master_node = search(:node, 'role:redis-master').first
default_redis_ip = master_node.ipaddress unless master_node.nil?
@justindossey
justindossey / proxy_test.rb
Created October 23, 2014 16:04
test various methods of performing HTTP requests from behind a proxy
#!/usr/bin/env ruby
require 'net/http'
require 'open-uri'
require 'rubygems'
require 'http' # this is the http gem
require 'faraday'
class ProxyTest
def initialize(url)
@justindossey
justindossey / kitchen-output.txt
Created October 16, 2014 23:16
kitchen converge output of bar/default.rb
Converging 2 resources
Recipe: bar::default
* file[/tmp/bar.txt] action create[2014-10-16T23:14:38+00:00] INFO: Processing file[/tmp/bar.txt] action create (bar::default line 13)
[2014-10-16T23:14:38+00:00] INFO: file[/tmp/bar.txt] created file /tmp/bar.txt
- create new file /tmp/bar.txt[2014-10-16T23:14:38+00:00] INFO: file[/tmp/bar.txt] updated file contents /tmp/bar.txt
- update content in file /tmp/bar.txt from none to 4cee35
--- /tmp/bar.txt 2014-10-16 23:14:38.033893771 +0000
+++ /tmp/.bar.txt20141016-1369-yghu83 2014-10-16 23:14:38.033893771 +0000