Skip to content

Instantly share code, notes, and snippets.

View Atalanta's full-sized avatar

Stephen Nelson-Smith Atalanta

  • Ticketmaster
  • Hampshire, UK
View GitHub Profile
include_recipe "git"
user "git" do
comment "Git User"
home "/srv/git"
end
directory "/srv/git" do
owner "git"
group "git"
chef > recipe
chef:recipe > bash "install Ruby 1.9.2" do
chef:recipe > user "root"
chef:recipe ?> code "rvm install 1.9.2 && rvm use 1.9.2 --default"
chef:recipe ?> not_if File.exists?('/usr/local/rvm/src/ruby-1.9.2-p0')
chef:recipe ?> end
=> bash[install Ruby 1.9.2]
Feature: Third Party Software Installable
In order to work effectively
As a member of the OpsEng team
I want to be able to install third party software
Scenario: No third party repo available
Given a fresh machine
And no third party repo is available
When I try to install Skype
$ od -c repo-test/features/third_party_software_installable.feature
0000000 F e a t u r e : T h i r d P
0000020 a r t y S o f t w a r e I n
0000040 s t a l l a b l e \n \n I n
0000060 o r d e r t o w o r k e f
0000100 f e c t i v e l y \n A s a
0000120 m e m b e r o f t h e O
0000140 p s E n g t e a m \n I w
0000160 a n t t o b e a b l e t
0000200 o i n s t a l l t h i r d
def apply_apt_repo_role
@vagrant = Vagrant::Environment.new
status = %x[vagrant status].split("\n")[4]
if status.start_with?("The VM is powered off")
puts ' Firing up remote VM for apt repo'
@vagrant.cli('up')
end
Vagrant::Config.run do |config|
config.chef.add_role("apt_repo")
end
execute "Add lucid32 box to user stephen (as a test)" do
user "stephen"
command "vagrant box add lucid32 http://files.vagrantup.com/lucid32.box"
creates "/home/stephen/.vagrant/boxes/lucid32"
action :run
environment ({'PATH' => '/usr/local/rvm/gems/ruby-1.9.2-p0/bin:/usr/local/rvm/gems/ruby-1.9.2-p0@global/bin:/usr/local/rvm/rubies/ruby-1.9.2-p0/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games'})
end
[ 2597.922615] warning: `VBoxHeadless' uses 32-bit capabilities (legacy support in use)
[ 2774.940447] vboxdrv: Found 2 processor cores.
[ 2774.940566] VBoxDrv: dbg - g_abExecMemory=ffffffffa0075800
[ 2774.940581] BUG: unable to handle kernel paging request at ffff8802f85ca000
[ 2774.940594] IP: [<ffffffffa0060c36>] supdrvInitDevExt+0x136/0x670 [vboxdrv]
[ 2774.940615] PGD 274a067 PUD 0
[ 2774.940621] Oops: 0002 [#1] SMP
[ 2774.940626] last sysfs file: /sys/devices/xen/vbd-2080/block/sdc/removable
[ 2774.940631] CPU 0
[ 2774.940634] Modules linked in: vboxdrv(+) ipv6
require 'rspec'
require 'fileutils'
require 'find'
class OggFileMover
def find_ogg_dirs(path)
dirs = Array.new
Find.find(path) do |p|
dirs << File.dirname(p) if p =~ /.*ogg$/
end
[default] [Wed, 29 Dec 2010 10:23:21 -0800] INFO: service[apache2]: restarted successfully
: stdout
[default] [Wed, 29 Dec 2010 10:23:21 -0800] ERROR: template[/etc/apache2/sites-available/smartpages.conf] (/srv/chef/cache/cookbooks/apache2/definitions/web_app.rb:29:in `from_file') had an error:
Cookbook smartpages not found
/usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/../lib/chef/cookbook/cookbook_collection.rb:38
/usr/lib/ruby/gems/1.8/gems/extlib-0.9.15/lib/extlib/mash.rb:31:in `call'
/usr/lib/ruby/gems/1.8/gems/extlib-0.9.15/lib/extlib/mash.rb:31:in `default'
/usr/lib/ruby/gems/1.8/gems/extlib-0.9.15/lib/extlib/mash.rb:31:in `default'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/../lib/chef/provider/template.rb:68:in `[]'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/../lib/chef/provider/template.rb:68:in `template_location'
app = node.run_state[:current_app]
use_ree = false
if node.run_state[:seen_recipes].has_key?("ruby_enterprise")
use_ree = true
end
if app['packages']
app['packages'].each do |pkg,ver|
package pkg do