-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added cql-box * fixed sudo rights in cql-box tasks * updated cassandra version in cql-box * Simplified setting up the cql box * added cql-box to travis
- Loading branch information
1 parent
e260762
commit ef6f33c
Showing
9 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# CQL box | ||
|
||
Here we provide an easy setup of a small 3 node cassandra cluster on a centos/7 box using vagrant and ansible. | ||
|
||
With the currently used centos/7 base box, we faced some issues with the installation of the guest additions on it. | ||
This failed, such that the ansible directory could not be mounted in the guest os, such that we couldn't provision the box using ansible. | ||
|
||
We've worked around it using a simple `yum update`, but it does require multiple `vagrant provision` and a `vagrant reload` call. | ||
|
||
TLDR; | ||
To get a centos box with a 3 node cassandra cluster on it, just run | ||
|
||
```bash | ||
./vagrant_start.sh | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# required: vagrant plugin install vagrant-vbguest | ||
Vagrant.configure("2") do |config| | ||
config.vm.box = "centos/7" | ||
config.vm.box_version = "<=1608.02" | ||
config.ssh.insert_key = false | ||
config.vbguest.auto_update = true | ||
|
||
config.vm.provision "shell", inline: "sudo yum update -y && sudo yum install -y kernel-devel" | ||
config.vm.provision "ansible_local" do |ansible| | ||
ansible.playbook = "provision.yml" | ||
ansible.inventory_path = "example-inventory/dev" | ||
ansible.provisioning_path = "/vagrant/cql-box" | ||
ansible.raw_arguments = ['-u vagrant'] | ||
end | ||
|
||
config.vm.synced_folder "..", "/vagrant", type: "virtualbox" | ||
|
||
#config.vm.network :forwarded_port, guest: 22, host: 2223 | ||
|
||
config.vm.define "bdr-cql-box", autostart: true do |vm| | ||
vm.vm.hostname = "cql-box" | ||
vm.vm.network "private_network", ip: "10.0.0.45" | ||
# to mount other folders: vm.vm.synced_folder "../../", "/home/vagrant/projects", :mount_options => ["dmode=644,fmode=644"] | ||
|
||
# Provision virtualbox: | ||
vm.vm.provider "virtualbox" do |vb| | ||
vb.memory = 5096 | ||
vb.cpus = 4 | ||
vb.customize ["modifyvm", :id, "--usb", "off"] | ||
vb.customize ["modifyvm", :id, "--usbehci", "off"] | ||
end | ||
end | ||
|
||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[defaults] | ||
roles_path = network:platform:components:../common/network:../common/platform:../common/components |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
cql_version: 3.0.0 | ||
cql_nodecount: 3 | ||
cql_clustername: test |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
|
||
- name: Ensure Java 8 is installed | ||
package: name=java-1.8.0-openjdk state=present | ||
become: yes | ||
|
||
- name: Get latest ccm version | ||
become: yes | ||
git: | ||
repo: https://github.com/pcmanus/ccm.git | ||
dest: ~/checkouts/ccm | ||
update: no | ||
|
||
- name: Install ccm | ||
become: yes | ||
command: ./setup.py install | ||
args: | ||
chdir: ~/checkouts/ccm | ||
creates: /usr/bin/ccm | ||
|
||
- name: Initiate cluster | ||
command: "ccm create --version {{cql_version}} --nodes {{cql_nodecount}} --start {{cql_clustername}}" | ||
args: | ||
creates: "~/.ccm/{{cql_clustername}}" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
bdr-cql-box ansible_connection=local advertised_host=10.0.0.45 | ||
|
||
[bdr-cql-box] | ||
bdr-cql-box | ||
|
||
[cql] | ||
bdr-cql-box |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
- hosts: all | ||
become: yes | ||
roles: | ||
- repositories | ||
tasks: | ||
- package: name=python-pip state=present | ||
- package: name=git state=present | ||
|
||
- hosts: cql | ||
roles: | ||
- cql |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
# sets up the vagrant box, working around failing guest additions cuasing failed mapped folders | ||
vagrant plugin install vagrant-vbguest && \ | ||
vagrant up && \ | ||
vagrant provision --provision-with shell && \ | ||
vagrant reload && \ | ||
vagrant provision --provision-with ansible_local |