This commit is contained in:
Jedrzej Nowak 2015-08-14 15:01:18 +02:00
parent 27d5c142f9
commit 1e8f380338
9 changed files with 116 additions and 0 deletions

View File

@ -0,0 +1,4 @@
- hosts: [{{ip}}]
sudo: yes
tasks:
- shell: riak-admin cluster commit

View File

@ -0,0 +1,18 @@
id: riak_commit
handler: ansible
version: 1.0.0
actions:
commit: actions/commit.yml
input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
riak_names:
schema: [{riak_name: str}]
value: []

View File

@ -0,0 +1,4 @@
- hosts: [{{ip}}]
sudo: yes
tasks:
- shell: riak-admin cluster join {{join_to}}

View File

@ -0,0 +1,18 @@
id: riak_join_single
handler: ansible
version: 1.0.0
actions:
join: actions/join.yml
input:
join_to:
schema: str!
value:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:

View File

@ -0,0 +1,4 @@
- hosts: [{{ip}}]
sudo: yes
tasks:
- shell: riak-admin cluster commit

View File

@ -0,0 +1,6 @@
- hosts: [{{ip}}]
sudo: yes
tasks:
- apt:
name: riak
state: absent

View File

@ -0,0 +1,25 @@
- hosts: [{{ip}}]
sudo: yes
tasks:
- shell: curl -s https://packagecloud.io/install/repositories/basho/riak/script.deb.sh | sudo bash
- apt:
name: riak
state: present
# - shell: sed -ie "s/127.0.0.1/{{ip}}/g" /etc/riak/riak.conf
- service:
name: riak
state: stopped
- replace:
dest: /etc/riak/riak.conf
regexp: '127.0.0.1'
replace: '0.0.0.0'
- replace:
dest: /etc/riak/riak.conf
regexp: '^nodename = .*\n'
replace: 'nodename = {{riak_name}}\n\n'
# TODO: should use name/hostname instead of ip
- shell: rm -fr /var/lib/riak/kv_vnode/*
- shell: rm -fr /var/lib/riak/ring/*
- service:
name: riak
state: reloaded

View File

@ -0,0 +1,17 @@
id: riak_node
handler: ansible
version: 1.0.0
actions:
input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
riak_name:
schema: str!
value:

20
templates/riak_nodes.yml Normal file
View File

@ -0,0 +1,20 @@
id: simple_riak_cluster
resources:
- id: node1
from: resources/ro_node
values:
ip: '10.0.0.3'
ssh_key: '/vagrant/.vagrant/machines/solar-dev1/virtualbox/private_key'
ssh_user: 'vagrant'
- id: node2
from: resources/ro_node
values:
ip: '10.0.0.4'
ssh_key: '/vagrant/.vagrant/machines/solar-dev2/virtualbox/private_key'
ssh_user: 'vagrant'
- id: node3
from: resources/ro_node
values:
ip: '10.0.0.5'
ssh_key: '/vagrant/.vagrant/machines/solar-dev3/virtualbox/private_key'
ssh_user: 'vagrant'