Skip to content

Instantly share code, notes, and snippets.

View sneal's full-sized avatar

Shawn Neal sneal

View GitHub Profile
@sneal
sneal / gist:6085244
Created July 26, 2013 01:11
Load vagrant-vmware-fusion plugin for vagrant plugin development
source "https://rubygems.org"
source "http://gems.hashicorp.com"
gemspec
group :development do
gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git", :tag => 'v1.2.2'
gem "vagrant-vmware-fusion", ">= 0.8.2"
end
@sneal
sneal / gist:7155901
Created October 25, 2013 14:51
This Vagrantifle snippet is using a "reboot" provisioner in vagrant-windows. The provisioner reboots the guest and then blocks vagrant execution until the VM finished its reboot.
# Install .NET 4.5 first
config.vm.provision :chef_solo do |chef|
chef.log_level = :info
chef.add_recipe 'dotnetframework'
chef.add_recipe 'minitest-handler'
end
# Need to reboot before .NET 4.5 install finishes
config.vm.provision :reboot
@sneal
sneal / gist:7267312
Last active May 13, 2023 15:07
Script to package a VMware Vagrant box from an existing Vagrant box instance
# Creates a new VMWare base box from an existing Vagrant VMWare box
# This script assumes it lives in the directory above where you store cookbooks (i.e. ~/src)
#
# Usage:
# ruby export_vmware_box.rb daptiv_dev_ppm_workstation vagrant-vmware-windows2008r2sp1.box
require 'fileutils'
#.vagrant/machines/default/vmware_fusion/0f721388-a327-4ba3-b203-c09f69016b43/
box_root_path = "#{Dir.pwd}/#{ARGV[0]}/.vagrant/machines/default/vmware_fusion"
$is_64bit = [IntPtr]::size -eq 8
# setup openssh
$ssh_download_url = "http://www.mls-software.com/files/setupssh-6.3p1-1.exe"
if ($is_64bit) {
Write-Host "64 bit OS found"
$ssh_download_url = "http://www.mls-software.com/files/setupssh-6.3p1-1(x64).exe"
}
If (!(Test-Path "C:\Program Files\OpenSSH\bin\ssh.exe")) {
package main
import (
"os"
"fmt"
"code.google.com/p/go.crypto/ssh"
)
type password string
@sneal
sneal / gist:8064758
Created December 21, 2013 02:47
Packer issue 738 debug log from Ubuntu 12.04 run I added a log message that prints out the result of the NextId function `Found NextId of: 562`
This file has been truncated, but you can view the full file.
Last login: Fri Dec 20 16:12:53 on ttys008
[~/src/daptiv-windows-boxes/daptiv_site_sso/win2k8r2sp1_standard (master)]$ cd ../..
[~/src/daptiv-windows-boxes (master)]$ cd ..
[~/src]$ cd basebox-packer
[~/src/basebox-packer (master)]$ ls
Makefile README.md template virtualbox vmware
[~/src/basebox-packer (master)]$ cd vmware
[~/src/basebox-packer/vmware (master)]$ ls
[~/src/basebox-packer/vmware (master)]$ cd ..
[~/src/basebox-packer (master)]$ cd template/
@sneal
sneal / gist:8071031
Created December 21, 2013 15:45
Still using connection id 0
[~/src/daptiv-windows-boxes/daptiv_site_sso/win2k8r2sp1_standard (master)]$ PACKER_LOG=debug packer build packer.json
2013/12/21 07:38:15 Packer Version: 0.5.0 dev 31df3abe9d721b7d42c33d69ddd4a017f3d9dde9+CHANGES
2013/12/21 07:38:15 Packer Target OS/Arch: darwin amd64
2013/12/21 07:38:15 Built with Go Version: go1.2
2013/12/21 07:38:15 Detected home directory from env var: /Users/sneal
2013/12/21 07:38:15 Attempting to open config file: /Users/sneal/.packerconfig
2013/12/21 07:38:15 File doesn't exist, but doesn't need to. Ignoring.
2013/12/21 07:38:15 Packer config: &{PluginMinPort:0 PluginMaxPort:0 Builders:map[amazon-ebs:packer-builder-amazon-ebs amazon-instance:packer-builder-amazon-instance digitalocean:packer-builder-digitalocean openstack:packer-builder-openstack qemu:packer-builder-qemu virtualbox:packer-builder-virtualbox vmware:packer-builder-vmware amazon-chroot:packer-builder-amazon-chroot docker:packer-builder-docker googlecompute:packer-builder-googlecompute] Commands:map[build:packer-command-bu
@sneal
sneal / daptiv_environments::production
Last active May 13, 2023 15:06
In addition to role cookbooks... a single environment cookbook with a recipe per environment. Allows locking of roles and environments to specific versions and keeps most of the configuration logically together without any secret sauce.
# turn off dev_mode for the entire production environment
node.override['daptiv_site']['dev_mode'] = false
@sneal
sneal / env_latest_cookbooks.rb
Created February 6, 2014 02:43
Script to generate a new Chef environment file using the latest cookbook versions from your Chef Server
require 'json'
env_name = ARGV[0]
raise "environment name is a required parameter" unless env_name
environment = Hash.new
environment[:name] = env_name
environment[:description] = "The #{env_name} environment"
cookbook_versions = Hash.new
@sneal
sneal / Vagrantfile.rb
Last active May 13, 2023 15:06
Gem install from Vagrantfile
require "rubygems"
# Install the Chef gem into the private Vagrant gem repo
CHEF_VERSION = '11.8.2'
def with_vagrant_gem_path
@old_gem_path = ENV["GEM_PATH"]
@old_gem_home = ENV["GEM_HOME"]
Gem.paths = ENV["GEM_PATH"] = ENV["GEM_HOME"] = "#{ENV['HOME']}/.vagrant.d/gems"
return yield