Ansible Riak is an Ansible role designed to install & configure Riak KV. In combination with Ansible hosts, it can be used to configure a single node or an entire cluster.
- Ansible 1.6+
$ ansible-galaxy install christophermancini.riak-kv
Then reference the role in your playbooks or other roles using the key christophermancini.riak-kv
.
To manually install this role, clone the repository or extract the distribution package to your roles directory.
For example, if you use the default location for roles, the roles directory would be a sibling of your playbook.yml file, roles/
. If you clone this repository to your roles directory, you would then reference the role with the key ansible-riak
.
All documentation for this role is included within this section of the README.
All of the variables that can be used in this role can be found in the variable defaults file. To override any of the default variables, all you have to do is set them in the vars:
section of your playbook.yml or create your own role that defines this role as a dependency, using the same var names used in this role.
There are currently four templates included with the role. The most important is the riak.conf.j2
template, as it configures the operating parameters for Riak KV. If you have specific operating requirements for your ring that differ significantly from the distribution configuration, you can override this template with your own.
There are two different ways to override the default template:
- Override the riak_conf_template variable and set it to the absolute / relative path to the template on the local system
- Create a new role that defines this role as a dependency and save your template file in the templates directory using the same exact name as the template you want to override, in this case
riak.conf.j2
---
- hosts: riak
sudo: true
roles:
- { role: ansible-riak }
vars:
riak_pb_bind_ip: 10.29.7.192
riak_pb_port: 10017
Internally, we have a vagrant-ansible package that some of us use to test our client libs. In this package, we created a role that sets up the environment needed for our library tests and declares this role as a dependency.
To build a cluster, you need to command your Riak node to join the cluster by providing it the ring leader. With this role, there are two ways you can do this. Via the command module and cli tool riak-admin or via the Ansible Riak module.
---
- hosts: riak
sudo: true
roles:
- { role: ansible-riak }
vars:
ring_leader: riak1@127.0.0.1
tasks:
- name: Join the cluster
command: '{{ riak_admin }} join {{ ring_leader }}'
- name: Check Riak Ring
command: '{{ riak_admin }} cluster status'
register: riak_ring_status
- name: Plan the cluster
command: '{{ riak_admin }} plan'
when: riak_ring_status.stdout.find('joining') > 0
- name: Commit the cluster
command: '{{ riak_admin }} commit
when: riak_ring_status.stdout.find('joining') > 0
---
- hosts: riak
sudo: true
roles:
- { role: ansible-riak }
vars:
ring_leader: riak1@127.0.0.1
tasks:
- name: Join the cluster
riak: command=join target_node={{ ring_leader }}
- name: Check Riak Ring
shell: 'riak-admin cluster status'
register: riak_ring_status
- name: Plan the cluster
riak: command=plan wait_for_ring=300
when: riak_ring_status.stdout.find('joining') > 0
- name: Commit the cluster
riak: command=commit wait_for_handoffs=300
when: riak_ring_status.stdout.find('joining') > 0
This repo's maintainers are engineers at Basho and we welcome your contribution to the project! You can start by reviewing CONTRIBUTING.md for information on everything from testing to coding standards.
Due to our obsession with stability and our rich ecosystem of users, community updates on this repo may take a little longer to review.
The most helpful way to contribute is by reporting your experience through issues. Issues may not be updated while we review internally, but they're still incredibly appreciated.
Thank you for being part of the community! We love you for it.
- Nothing planned at this time.
- Author: Bryan Hunt (https://github.com/binarytemple)
- Author: Christopher Mancini (https://github.com/christophermancini)
Copyright (c) 2016 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"). For more details, see License.