Skip to content

Instantly share code, notes, and snippets.

View larstobi's full-sized avatar

Lars Tobias Skjong-Børsting larstobi

  • Skylars AS
  • Oslo, Norway
View GitHub Profile
@larstobi
larstobi / foreman-report.rb.erb
Created February 13, 2012 12:28
Send Puppet reports to Foreman
# copy this file to your report dir - e.g. /usr/lib/ruby/1.8/puppet/reports/
# add this report in your puppetmaster reports - e.g, in your puppet.conf add:
# reports=log, foreman # (or any other reports you want)
# URL of your Foreman installation
$foreman_url='<%= scope.lookupvar("foreman::foreman_url") %>'
$relative_url_root = '<%= scope.lookupvar("foreman::relative_url_root") %>'
require 'puppet'
require 'net/http'
@larstobi
larstobi / localrecord.rb
Created February 20, 2012 13:13
Update from a local DNS record set to AWS Route53
class Localrecord
attr_accessor :name
attr_accessor :value
attr_accessor :type
attr_accessor :ttl
attr_accessor :weight
def initialize(options = {})
@name = options['name']
@type = options['type']
@larstobi
larstobi / error
Created February 20, 2012 13:17
Error message
/Users/larstobi/.rvm/gems/ruby-1.8.7-p352/gems/excon-0.9.5/lib/excon/connection.rb:232:in `request_kernel': Expected(200) <=> Actual(400 Bad Request) (Excon::Errors::BadRequest)
request => {:scheme=>"https", :expects=>200, :path=>"/2010-10-01/hostedzone/asdf/rrset", :connect_timeout=>60, :method=>"POST", :instrumentor_name=>"excon", :query=>nil, :headers=>{"Date"=>"Mon, 20 Feb 2012 13:07:27 +0000", "X-Amzn-Authorization"=>"AWS3-HTTPS AWSAccessKeyId=asdf,Algorithm=HmacSHA1,Signature=asdf", "Content-Length"=>445, "Host"=>"route53.amazonaws.com:443"}, :host=>"route53.amazonaws.com", :body=>"<?xml version=\"1.0\" encoding=\"UTF-8\"?><ChangeResourceRecordSetsRequest xmlns=\"https://route53.amazonaws.com/doc/2010-10-01/\"><ChangeBatch><Changes><Change><Action>CREATE</Action><ResourceRecordSet><Name>mydns.example.net.</Name><Type>A</Type><TTL>60</TTL><ResourceRecords><ResourceRecord><Value>1.2.3.4</Value></ResourceRecord></ResourceRecords></ResourceRecordSet></Change></Changes></ChangeBatch></ChangeResourceRecordS
@larstobi
larstobi / s3-sync.rb
Created March 19, 2012 14:08
Sync directory to Amazon S3
#!/usr/bin/env ruby
require 'rubygems'
require 'fog'
require 'digest/md5'
local_directory = 'bootstrap'
remote_directory = 'bootstrap'
bucket_name = 'mybucket'
provider = 'AWS'
region = 'eu-west-1'
@larstobi
larstobi / data.pp
Created June 8, 2012 12:39
puppet module acl
class acl::data {
$packages = $operatingsystem ? {
/Ubuntu|Debian/ => ['acl'],
default => fail("Module does not support ${::operatingsystem}"),
}
}
@larstobi
larstobi / hieradata.yaml
Created September 14, 2012 11:06 — forked from zipkid/hieradata.yaml
Using hiera as node classifier.
:hierarchy:
- Nodes/%{fqdn}
- Domain/%{domain}
- %{environment}
- common
:backends:
- yaml
- puppet
---
# Newstyle
classes:
- 'portal::foo'
- 'portal::bar'
- 'blahblah'
db_host: 'db123.domain'
baz: 'quz'
class jboss (
$java_opts = hiera('jboss_java_opts', ''),
$db_connection_url = hiera('db_connection_url'),
) {
file {
'/etc/jboss/jboss.conf':
ensure => present,
content => template('jboss/jboss.conf.erb');
'/opt/jbossas/standalone/configuration/standalone.xml':
ZFS versions
ii dkms 2.2.0.3-1ubuntu3+zfs3 Dynamic Kernel Module Support Framework
ii mountall 2.36.2-zfs1 filesystem mounting tool
ii spl-dkms 0.6.0.91-0ubuntu1~precise1 Solaris Porting Layer kernel modules for Linux
ii spl 0.6.0.91-0ubuntu1~precise1 Solaris Porting Layer utilities for Linux
ii zfs-dkms 0.6.0.91-0ubuntu1~precise1 Native ZFS filesystem kernel modules for Linux
ii ubuntu-zfs 7~precise Native ZFS filesystem metapackage for Ubuntu.
ii zfsutils 0.6.0.91-0ubuntu1~precise1 Native ZFS management utilities for Linux
ii libnvpair1 0.6.0.91-0ubuntu1~precise1 Solaris name-value library for Linux
ii libuutil1 0.6.0.91-0ubuntu1~precise1 Solaris userland utility library for Linux
class passenger::github(
$require = hiera('passenger::github::require', undef)
) {
if defined($require) {
Class['passenger::github'] -> $require
}
}