Skip to content

Instantly share code, notes, and snippets.

View jeroenr's full-sized avatar

Jeroen Rosenberg jeroenr

View GitHub Profile
@jeroenr
jeroenr / Vagrantfile
Created March 15, 2012 15:33
Vagrant configuration for Puppet provisioning
### Config for Vagrant using Puppet provisioning. Requires 0.9.5 or higher ###
# Configuration
hostname = "elmar-test-jero"
puppet_manifests = "~/Projects/Puppet/manifests/"
puppet_modules = "~/Projects/Puppet/modules/"
## ================================
# Don't edit below unless you know what you're doing
## ================================
@jeroenr
jeroenr / example.pp
Created March 16, 2012 09:06
Using puppet templates example
## Use template from module 'elmar'
class repo-nonfree {
file { "/etc/apt/sources.list.d/non-free.list":
ensure => present,
content => $operatingsystem ? {
"ubuntu" => template("elmar/apt/sources.list.d/ubuntu-partner.list.erb"),
"debian" => template("elmar/apt/sources.list.d/non-free.list.erb"),
default => template("elmar/apt/sources.list.d/non-free.list.erb"),
},
@jeroenr
jeroenr / example.pp
Created March 16, 2012 09:24
Using puppet filebucket example
file { "/etc/apt/trusted.gpg.d/mozilla.gpg":
ensure => present,
source => $operatingsystem ? {
"ubuntu" => "puppet:///elmar/apt/trusted.gpg.d/mozilla_ubuntu.gpg",
"debian" => "puppet:///elmar/apt/trusted.gpg.d/mozilla_debian.gpg",
},
notify => Exec["aptgetupdate"],
}
@jeroenr
jeroenr / deploy.rb
Created April 5, 2012 14:02
Capistrano deploy:setup task without root permission
namespace :deploy do
task :setup, :except => { :no_release => true } do
dirs = [deploy_to, releases_path, shared_path]
dirs += shared_children.map { |d| File.join(shared_path, d.split('/').last) }
run "mkdir -p #{dirs.join(' ')}"
run "chmod g+w #{dirs.join(' ')}" if fetch(:group_writable, true)
end
end
@jeroenr
jeroenr / Vagrantfile.rb
Created April 13, 2012 06:56
Multi VM setup with Vagrant
### Elmar configuration file for Vagrant. Requires 0.9.5 or higher ###
## ================================
# Don't edit below unless you know what you're doing
## ================================
Vagrant::Config.run do |config|
config.vm.define :frontend do |frontend_config|
## Provisioning
frontend_config.vm.provision :puppet do |puppet|
puppet.module_path = "modules"
@jeroenr
jeroenr / import.rb
Created May 1, 2012 14:42
Replace box name with uuid before passing ovf to VirtualBox to enable parallellization
require 'uuid'
module Vagrant
module Action
module VM
class Import
def initialize(app, env)
@app = app
end
@jeroenr
jeroenr / Gemfile
Created May 9, 2012 12:35
Implementation of an asynchronous execution of blocks on items in a collection, applied to enumerable using monkey patching
source :rubygems
gem 'rake', '0.8.7'
gem "retroactive_module_inclusion", "~> 1.2.5"
@jeroenr
jeroenr / config.rb
Created May 14, 2012 15:17
Capistrano deployment script for play2 application
namespace :deploy do
task :restart do
stop
sleep 1
start
end
task :start do
targets = find_servers_for_task(current_task)
@jeroenr
jeroenr / Capfile
Created May 17, 2012 07:08
Elmar on rails
load 'deploy/assets'
@jeroenr
jeroenr / deploy.rb
Created May 22, 2012 15:20
Deploying play2 application with capistrano
set :deploy_to, "/usr/share/my-app"
namespace :play do
task :setup do
run "mkdir -p #{deploy_to}"
upload "my-app/start.sh", "#{deploy_to}/start.sh", :mode => '755', :via => :scp
upload "my-app/stop.sh", "#{deploy_to}/stop.sh", :mode => '755', :via => :scp
end
task :deploy do