Last active
January 2, 2016 18:39
-
-
Save ranjib/8344888 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
curl -L https://www.opscode.com/chef/install.sh | bash
curl -L https://gist.github.com/ranjib/8344888/raw/scratch.rb | chef-apply -s