lib/vagabond/cookbooks/vagabond/recipes/default.rb in vagabond-0.2.6 vs lib/vagabond/cookbooks/vagabond/recipes/default.rb in vagabond-0.2.8
- old
+ new
@@ -31,10 +31,11 @@
node.set[:lxc][:dhcp_range] = "#{l_net}.2,#{l_net}.199"
node.set[:lxc][:dhcp_max] = '199'
end
=end
+include_recipe 'apt::cacher-ng'
include_recipe 'lxc'
ruby_block 'LXC template: lxc-centos' do
block do
dir = %w(/usr/share /usr/lib).map do |prefix|
@@ -64,44 +65,52 @@
'upgrade -y -q',
'install curl -y -q'
]
if(!options[:template].scan(%r{debian|ubuntu}).empty?)
pkg_man = 'apt-get'
+ proxy = ["echo \"Acquire::http::Proxy \\\"http://#{node[:lxc][:addr]}:#{node[:apt][:cacher_port]}\\\";\" > /etc/apt/apt.conf.d/01proxy"]
+ proxy << "echo \"Acquire::https::Proxy \\\"DIRECT\\\";\" >> /etc/apt/apt.conf.d/01proxy"
elsif(!options[:template].scan(%r{fedora|centos}).empty?)
pkg_man = 'yum'
end
if(pkg_man)
pkg_coms.map! do |c|
"#{pkg_man} #{c}"
end
else
pkg_coms = []
end
+ pkg_coms = proxy + pkg_coms if proxy
lxc_container name do
template options[:template]
template_opts options[:template_options]
default_config false if options[:memory]
create_environment options[:environment] if options[:environment]
initialize_commands [
+ 'locale-gen en_US.UTF-8',
+ 'update-locale LANG="en_US.UTF-8"',
'rm -f /etc/sysctl.d/10-console-messages.conf',
'rm -f /etc/sysctl.d/10-ptrace.conf',
'rm -f /etc/sysctl.d/10-kernel-hardening.conf'
] + pkg_coms + [
'curl -L https://www.opscode.com/chef/install.sh | bash'
]
end
end
+=begin
+# TODO: This will be the base for building ephemeral servers
lxc_container 'chef-server' do
clone 'ubuntu_1204'
initialize_commands [
]
only_if do
node[:vagabond][:server_base]
end
end
+=end
node[:vagabond][:customs].each do |name, options|
lxc_container name do
action :create