Deploying Datastax Enterprise with Vagrant and bash

After configuring my new shiny MacBook I started to think about how to establish a Datastax Enterprise Environment on my Notebook. First I wanted to have it cost free and secondly automated, what took me to Vagrant and Virtualbox. I checked different repositories but they always used a config management like chef, puppet or ansible what´s great for production or a datacenter. I decided to use new bash scripts in a Vagrantfile and to copy the cassandra.yaml and hosts file to have the ability to edit them offline.

So I installed Vagrant and added a new Ubuntu box to the repository. Then I configured a new clustered definition like this:

boxes = [
  { :name => ‘dse-node0’, :ip => ‘’, :cpus =>2, :memory => 4096 },
  { :name => ‘dse-node1’, :ip => ‘’, :cpus =>2, :memory => 4096 },
  { :name => ‘dse-node2’, :ip => ‘’, :cpus =>2, :memory => 4096 }
Vagrant.configure(“2”) do |config| = “bash -c ‘BASH_ENV=/etc/profile exec bash'”
  boxes.each do |val|
    config.vm.define val[:name] do |config| = “Ubuntu”
      config.vm.provider :virtualbox do |v|
        v.customize [“modifyvm”, :id, “–memory”, val[:memory]]
        v.customize [“modifyvm”, :id, “–cpus”, val[:cpus] ] :private_network, ip: val[:ip]
      config.vm.provision :shell, :inline => “cp -fv /vagrant/hosts /etc/hosts”
      if val[:name] == “dse-node0”
        config.vm.provision :shell, :path => “”
        config.vm.provision :shell, :path => “”
        config.vm.provision :shell, :inline => “sed -i ‘s/listen_address:.*$/listen_address: #{val[:ip]}/’ /etc/dse/cassandra/cassandra.yaml”


As you can see there is a first and a additional node (first node holds the Opscenter as well, only for testing purpose). In this example there are only three nodes but it is more than easy to add additional ones.


I added some scripts for the network interfaces, the pre-reqs and the services. The thing to notice is, that you have to add your own username and password in the external scripts which you can have for free.

The whole scripts can be found in my GitHub repository:

After the “vagrant up” run is completed you can just “Manage an existing cluster” in the OpsCenter ( in my case).

Opscenter 5.0.0

Feel free to check it out and commit or comment 🙂


Leave a Reply