1it.riak

Ansible Role for Riak KV & TS

Build Status Ansible Galaxy

Ansible Riak is an Ansible role for installing and setting up Riak KV & TS. It can be used to configure one node or an entire cluster by using Ansible.

  1. Installation
  2. Documentation
  3. Examples
  4. Contributing
  5. Roadmap
  6. License and Authors

Installation

Requirements

  • Ansible version 2.1 or higher

Installing from Ansible Galaxy

Run the command:

$ ansible-galaxy install 1it.riak

Then use the role in your playbooks by referencing 1it.riak.

Manual Installation

To install this role manually, you can clone the repository or extract the package to your roles directory.

For instance, if you use the standard location for roles, it should be next to your playbook.yml file, like roles/. If you clone the repository to your roles directory, reference the role with ansible-riak.

Documentation

You can find all documentation related to this role in this section of the README.

Variables

A list of variables that can be used with this role is available in the variable defaults file. If you want to change any default variable, just set it in the vars: section of your playbook.yml or create your own role that lists this role as a dependency, using the same variable names.

Templates

This role comes with four templates, the most crucial being riak.conf.j2, which sets the configurations for Riak KV. If you need different settings than the default ones, you can replace this template with your own.

You can override the template in two ways:

  • Change the riak_conf_template variable to point to your template file.
  • Create another role listing this role as a dependency, and place your template file in the templates directory, naming it exactly like the original, riak.conf.j2.

Examples

Changing Default Variables in a Playbook

---
- hosts: riak
  sudo: true
  roles:
    - { role: 1it.riak }
  vars:
    riak_pb_bind_ip: 10.29.7.192
    riak_pb_port:    10017

Changing Default Variables through Role Dependency

We have a vagrant-ansible package used for testing our libraries. We also created a role to set up the needed environment for our tests, which lists this role as a dependency.

Installing Riak TS

---
- hosts: riakts
  sudo: true
  roles:
    - { role: 1it.riak }
  vars:
    riak_package: 'riak-ts'
    riak_backend: leveldb
    riak_node_name: "riak@{{ ansible_default_ipv4['address'] }}"
    riak_shell_group: 'riak-ts'
    riak_anti_entropy: off
  tasks:
    - name: Set object size warning threshold
      lineinfile: dest=/etc/riak/riak.conf line="object.size.warning_threshold = 50K" regexp="^object.size.warning_threshold ="

    - name: Set object size maximum threshold
      lineinfile: dest=/etc/riak/riak.conf line="object.size.maximum = 500K" regexp="^object.size.maximum ="

Building a Cluster

To build a cluster, you need to tell your Riak node to join the cluster by specifying the ring leader. You can do this in two ways: using the command module and the riak-admin CLI tool, or through the Ansible Riak module.

Using Command Module

---
- hosts: riak
  sudo: true
  roles:
    - { role: 1it.riak }
  vars:
    ring_leader: [email protected]
  tasks:
    - name: Join the cluster
      command: '{{ riak_admin }} cluster join {{ ring_leader }}'

    - name: Check Riak Ring
      command: '{{ riak_admin }} cluster status'
      register: riak_ring_status

    - name: Plan the cluster
      command: '{{ riak_admin }} cluster plan'
      when: riak_ring_status.stdout.find('joining') > 0

    - name: Commit the cluster
      command: '{{ riak_admin }} cluster commit'
      when: riak_ring_status.stdout.find('joining') > 0

Using Riak Module

The Riak module has the added benefit of using the wait_for_ring and wait_for_handoffs features.

---
- hosts: riak
  sudo: true
  roles:
    - { role: 1it.riak }
  vars:
    ring_leader: [email protected]
  tasks:
    - name: Join the cluster
      riak: command=join target_node={{ ring_leader }}

    - name: Check Riak Ring
      command: '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

Contributing

We welcome contributions to this project! If you’d like to help out, check the CONTRIBUTING.md file for guidelines on testing and coding standards.

Roadmap

  • No plans at this time.

License and Authors

Copyright (c) 2016 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"). For more details, see License.

Informazioni sul progetto

Installs and configures Riak KV and TS, a distributed, highly available NoSQL and TimeSeries database.

Installa
ansible-galaxy install 1it.riak
Licenza
other
Download
144
Proprietario
Site Reliability Engineer