mirror of
https://github.com/discourse/discourse.git
synced 2024-12-05 11:46:18 +08:00
f3bcbd8bc3
This introduces two configuration management runs into the Vagrant provisioning phase. The first chef-solo run ensures that a current version of chef is installed using the omnibus updater. The second chef-solo run installs vim and phantomjs. Much more is possible, this is a proof of concept. Cookbooks are stored in the chef directory, and managed by librarian-chef, which is like a bundler for cookbooks. Chef is run when VM is first downloaded and booted, but not on subsequent halt/up cycles. To force chef to run again, use `vagrant provision`.
31 lines
1.1 KiB
Ruby
31 lines
1.1 KiB
Ruby
include_recipe 'omnibus_updater::set_remote_path'
|
|
|
|
remote_file "chef omnibus_package[#{File.basename(node[:omnibus_updater][:full_uri])}]" do
|
|
path File.join(node[:omnibus_updater][:cache_dir], File.basename(node[:omnibus_updater][:full_uri]))
|
|
source node[:omnibus_updater][:full_uri]
|
|
backup false
|
|
not_if do
|
|
File.exists?(
|
|
File.join(node[:omnibus_updater][:cache_dir], File.basename(node[:omnibus_updater][:full_uri]))
|
|
) || (
|
|
Chef::VERSION.to_s.scan(/\d+\.\d+\.\d+/) == node[:omnibus_updater][:full_version].scan(/\d+\.\d+\.\d+/) && OmnibusChecker.is_omnibus?
|
|
)
|
|
end
|
|
notifies :create, 'ruby_block[Omnibus Chef install notifier]', :delayed
|
|
end
|
|
|
|
ruby_block 'Omnibus Chef install notifier' do
|
|
block do
|
|
true
|
|
end
|
|
action :nothing
|
|
notifies :run, "execute[chef omnibus_install[#{node[:omnibus_updater][:full_version]}]]", :delayed
|
|
end
|
|
|
|
execute "chef omnibus_install[#{node[:omnibus_updater][:full_version]}]" do
|
|
command "dpkg -i #{File.join(node[:omnibus_updater][:cache_dir], File.basename(node[:omnibus_updater][:full_uri]))}"
|
|
action :nothing
|
|
end
|
|
|
|
include_recipe 'omnibus_updater::old_package_cleaner'
|