Skip to content

Instantly share code, notes, and snippets.

@ranjib
Last active January 2, 2016 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ranjib/8344888 to your computer and use it in GitHub Desktop.
Save ranjib/8344888 to your computer and use it in GitHub Desktop.
execute "apt_update" do
command "apt-get update -y"
end
%w{ ack-grep autoconf automake autotools-dev binutils bridge-utils
build-essential coreutils debootstrap dnsmasq-base doxygen fakeroot
git gnutls-bin golang golang-src htop iproute2 libdevmapper-dev
libgnutls-dev libgnutls26 make ncurses-base ncurses-bin ncurses-term libssl-dev
openssl python3.3 python3.3-dev strace tcpdump telnet tmux vim wget zlib1g
zlib1g-dev python3-software-properties}.each do |pkg|
package pkg do
action :install
end
end
execute "add_lxc_ppa" do
command "add-apt-repository -y ppa:ubuntu-lxc/daily"
action :run
notifies :run, "execute[apt_update]", :immediately
end
%w{lxc lxc-dev lxc-templates lxctl}.each do |pkg|
package pkg
end
git "/opt/ruby_lxc" do
action :export
repository 'https://github.com/lxc/ruby-lxc.git'
notifies :run, "execute[install_lxc_ruby_dependency]"
notifies :run, "execute[compile_lxc_ruby]"
notifies :run, "ruby_block[install_lxc_ruby]"
end
execute "install_lxc_ruby_dependency" do
command "/opt/chef/embedded/bin/bundle install --path .bundle"
cwd "/opt/ruby_lxc"
action :nothing
end
execute "compile_lxc_ruby" do
command "/opt/chef/embedded/bin/bundle exec rake package"
cwd "/opt/ruby_lxc"
action :nothing
end
ruby_block 'install_lxc_ruby' do
block do
include Chef::Mixin::ShellOut
pkg = Dir['/opt/ruby_lxc/pkg/*.gem'].first
shell_out!('/opt/chef/embedded/bin/gem install '+ pkg)
end
action :nothing
end
execute "install_lxc_ruby" do
command "/opt/chef/embedded/bin/gem install pkg"
cwd "/opt/ruby_lxc"
action :nothing
end
execute "apt_update" do
command "apt-get update -y"
end
%w{ ack-grep autoconf automake autotools-dev binutils bridge-utils
build-essential coreutils debootstrap dnsmasq-base doxygen fakeroot
git gnutls-bin golang golang-src htop iproute2 libdevmapper-dev
libgnutls-dev libgnutls26 make ncurses-base ncurses-bin ncurses-term libssl-dev
openssl python3.3 python3.3-dev strace tcpdump telnet tmux vim wget zlib1g
zlib1g-dev python3-software-properties}.each do |pkg|
package pkg do
action :install
end
end
execute "add_lxc_ppa" do
command "add-apt-repository -y ppa:ubuntu-lxc/daily"
action :run
notifies :run, "execute[apt_update]", :immediately
end
%w{lxc lxc-dev lxc-templates lxctl}.each do |pkg|
package pkg
end
git "/opt/lxc_lab" do
action :sync
repository 'https://github.com/sstephenson/ruby-build.git'
end
bash "install_ruby" do
cwd "/opt/lxc_lab"
code "./bin/ruby-build 1.9.3-p448 /opt/lxc_lab/ruby"
creates "/opt/lxc_lab/ruby/bin/ruby"
notifies :run, 'execute[update_rubygems]'
end
execute 'update_rubygems' do
command '/opt/lxc_lab/ruby/bin/gem update --system'
action :nothing
end
gem_package "bundler" do
gem_binary "/opt/lxc_lab/ruby/bin/gem"
end
git "/opt/lxc_lab/ruby_lxc" do
action :sync
repository 'https://github.com/lxc/ruby-lxc.git'
notifies :run, "execute[install_lxc_ruby_dependency]"
notifies :run, "execute[compile_lxc_ruby]"
end
execute "install_lxc_ruby_dependency" do
command "/opt/lxc_lab/ruby/bin/bundle install --path .bundle"
cwd "/opt/lxc_lab/ruby_lxc"
path ["/opt/lxc_lab/ruby/bin"]
action :nothing
end
execute "compile_lxc_ruby" do
command "/opt/lxc_lab/ruby/bin/bundle exec rake package"
cwd "/opt/lxc_lab/ruby_lxc"
environment('PATH' => "/opt/lxc_lab/ruby/bin")
action :nothing
end
@ranjib
Copy link
Author

ranjib commented Jan 10, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment