Here’s a brief guide to configuring Vagrant to install JDK 1.7 from Oracle and to configure RabbitMQ with specified plugins. The JDK installation is simply a question of using the current Java cookbook, but specifying the location of the JDK archive (and, optionally, its checksum).
The RabbitMQ issue needed a bit of customisation of the cookbook. My update to the rabbitmq cookbook (https://github.com/janm399/rabbitmq, pull requested) adds the [:rabbitmq][:enabled_plugins] node (an array of strings), which enables the listed plugins.
Onwards to a typical Vagrantfile, then:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.box = "box"
config.vm.boot_mode = :headless
config.vm.forward_port 80, 8080
config.vm.forward_port 55672, 55672
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "rabbitmq"
chef.add_recipe "java"
chef.json = {
:rabbitmq => {
:enabled_plugins => ["rabbitmq_management"]
},
:java => {
:install_flavor => "oracle",
:jdk_version => "7",
:jdk => {
:"7" => {
:x86_64 => {
:url => "http://host/jdk-7u4-linux-x64.tar.gz",
:checksum => "92f...0307c"
}
}
}
}
}
end
end
Notice the chef.json configuration, which specifies the list of RabbitMQ plugins (:rabbitmq => { :enabled_plugins => ["rabbitmq_management"] }) and the JDK download configuration. Even though you might download the JDK archive as .gz file, you will have to name it .tar.gz.
