Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Mancini committed Oct 10, 2016
2 parents 7861645 + f00c1b0 commit 35a88cf
Show file tree
Hide file tree
Showing 15 changed files with 167 additions and 167 deletions.
34 changes: 34 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
language: python
python: "2.7"

sudo: required
dist: trusty

addons:
hosts:
- riak-test

install:
- sudo apt-get install -y software-properties-common python-software-properties
- sudo add-apt-repository -y ppa:ansible/ansible
- sudo apt-get update -y
- sudo apt-get install -y ansible
- echo 'riak-test' | sudo tee -a /etc/ansible/hosts

# Check ansible version
- ansible --version

# Create ansible.cfg with correct roles_path
- 'printf "[defaults]\nroles_path=../" > ansible.cfg'

env:
- ANSIBLE_HOST_KEY_CHECKING=False

script:
- ansible-playbook tests/test.yml -v

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
slack:
secure: ZtgcjTxhTxrzWW6MIHLRtucW/BMm42RKS3nGRtSfgER9rx7oJ0Y9gOYkh1FM0GsM7Z11Q/iDhWs/8WTccAV0PrMZ6KHaq54wGmfYyqwPM4YreUwQ87PnOW4wZbl0TJTeWutasEwZvnVJ8VEyyQcS2PHt0zlsENn0XWvobvaZ+FM=
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ansible Role for Riak KV
# Ansible Role for Riak KV & TS

**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](#building-a-cluster).
**Ansible Riak** is an Ansible role designed to install & configure Riak KV & TS. In combination with Ansible hosts, it can be used to configure a single node or an [entire cluster](#building-a-cluster).

1. [Installation](#installation)
1. [Documentation](#documentation)
Expand All @@ -14,7 +14,7 @@

### Dependencies

* Ansible 1.6+
* Ansible 2.0+

### Ansible Galaxy Install

Expand Down Expand Up @@ -64,6 +64,21 @@ There are two different ways to override the default template:
Internally, we have a [vagrant-ansible package](basho-labs/riak-clients-vagrant) that some of us use to test our client libs. In this package, we [created a role](https://github.com/basho-labs/riak-clients-vagrant/tree/master/provisioning/roles/integration_testing) that sets up the environment needed for our library tests and declares [this role as a dependency](https://github.com/basho-labs/riak-clients-vagrant/blob/master/provisioning/roles/integration_testing/meta/main.yml).
#### Installing Riak TS
```yaml
---
- hosts: riakts
sudo: true
roles:
- { role: ansible-riak }
vars:
riak_package: 'riak-ts'
riak_backend: leveldb
riak_node_name: "riak@{{ ansible_default_ipv4['address'] }}"
riak_shell_group: 'riak-ts'
```
#### Building a Cluster
To [build a cluster](http://docs.basho.com/riak/latest/ops/building/basic-cluster-setup/), you need to command your Riak node to [join the cluster](http://docs.basho.com/riak/latest/ops/running/cluster-admin/#join) by providing it the ring leader. With this role, there are two ways you can do this. Via the [command module](http://docs.ansible.com/ansible/command_module.html) and cli tool riak-admin or via the [Ansible Riak module](http://docs.ansible.com/ansible/riak_module.html).
Expand Down
26 changes: 17 additions & 9 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,35 @@
riak_package: riak

riak_enterprise: false
riak_usr_lib: /usr/lib

riak_admin: '/usr/sbin/riak-admin'

riak_conf_template: riak.conf.j2

riak_node_name: 'riak@{{ ansible_fqdn }}'

riak_ring_size: 64

riak_backend: bitcask

riak_pb_bind_ip: 0.0.0.0
riak_pb_port: 8087

riak_http_bind_ip: 0.0.0.0
riak_http_port: 8098

riak_control: "off"
riak_search: "off"
riak_https_bind_ip: 0.0.0.0
riak_https_port: 10011

riak_ring_size: 64
riak_backend: bitcask
riak_control: 'off'
riak_search: 'off'

riak_leveldb_max_mem_percent: 70

riak_net_speed: 1Gb

riak_anti_entropy: active

riak_security_enabled: false

# riak_shell configuration
riak_shell_group: 'riak'
riak_shell_interface: 'ansible_eth0'
Expand Down Expand Up @@ -62,6 +64,11 @@ riak_scheduler: noop
# - { name: maps, props: '{"props":{"datatype":"map"}}' }
# - { name: sets, props: '{"props":{"datatype":"set"}}' }

# Create groups
#
#riak_groups:
# - admins
# - keysusers

# Create users
#
Expand All @@ -81,5 +88,6 @@ riak_scheduler: noop
# Create permission grants
#
#riak_grants:
# - {subject: 'user', bucket_type: 'certificate', bucket: '', permissions: ''}
# - {subject: 'group', bucket_type: 'password', bucket: '', permissions: ''}
# - {subject: 'all', scope: 'any', permissions: ''}
# - {subject: 'user', scope: 'mybuckettype', permissions: ''}
# - {subject: 'group', scope: 'mybuckettype mybucket', permissions: ''}
106 changes: 12 additions & 94 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,112 +1,30 @@
---
galaxy_info:
author: James Martin <jmartin@basho.com>
description: "Installs and configures Riak, a distributed, highly available NoSQL database."
author: Christopher Mancini <cmancini@basho.com>
description: "Installs and configures Riak KV and TS, a distributed, highly available NoSQL and TimeSeries database."
company: Basho
license: Apache
min_ansible_version: 1.4
#
# Below are all platforms currently available. Just uncomment
# the ones that apply to your role. If you don't see your
# platform on this list, let us know and we'll get it added!
#
min_ansible_version: 2.1
platforms:
- name: EL
versions:
# - all
- 6
- 7
#- name: GenericUNIX
# versions:
# - all
# - any
#- name: Fedora
# versions:
# - all
# - 16
# - 17
# - 18
# - 19
# - 20
#- name: opensuse
# versions:
# - all
# - 12.1
# - 12.2
# - 12.3
# - 13.1
# - 13.2
#- name: GenericBSD
# versions:
# - all
# - any
#- name: FreeBSD
# versions:
# - all
# - 8.0
# - 8.1
# - 8.2
# - 8.3
# - 8.4
# - 9.0
# - 9.1
# - 9.1
# - 9.2
- name: Ubuntu
versions:
# - all
# - lucid
# - maverick
# - natty
# - oneiric
- precise
# - quantal
# - raring
# - saucy
- trusty
# - utopic
# - vivid
#- name: SLES
# versions:
# - all
# - 10SP3
# - 10SP4
# - 11
# - 11SP1
# - 11SP2
# - 11SP3
#- name: GenericLinux
# versions:
# - all
# - any
- wily
- xenial
- name: Debian
versions:
# - all
# - etch
# - lenny
# - squeeze
- wheezy
#
# Below are all categories currently available. Just as with
# the platforms above, uncomment those that apply to your role.
#
categories:
#- cloud
#- cloud:ec2
#- cloud:gce
#- cloud:rax
- jessie
galaxy_tags:
- database
- database:nosql
#- database:sql
#- development
#- monitoring
#- networking
#- packaging
#- system
#- web
- nosql
- web
- basho
- timeseries
- riak
dependencies: []
# List your role dependencies here, one per line. Only
# dependencies available via galaxy should be listed here.
# Be sure to remove the '[]' above if you add dependencies
# to this list.

32 changes: 17 additions & 15 deletions tasks/Debian.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
---
- name: Include DEB vars
include_vars: Debian.yml
tags: Debian

- name: Install Pre-requisites
package: name={{ item }} state=present update_cache=yes cache_valid_time=3600
tags: Debian
with_items:
- curl
- apt-transport-https
- openjdk-7-jre
- default-jre

- name: Fetch ansible ansible_version
local_action: shell ansible --version
register: ans_ver
- name: Check if Riak is installed
stat: path=/etc/riak/riak.conf
register: dist

- name: Add Package Cloud repository key without validation
apt_key: url=https://packagecloud.io/gpg.key state=present validate_certs=no
tags: Debian
when: ans_ver.stdout.find(' 1.5.') > 0

- name: Add Package Cloud repository key with validation
apt_key: url=https://packagecloud.io/gpg.key state=present
tags: Debian
when: ans_ver.stdout.find(' 1.5.') < 0
when:
- not dist.stat.exists

- name: Add Basho Riak repository (hosted at Package Cloud)
template: src=deb_repo.list.j2 dest=/etc/apt/sources.list.d/basho_riak.list owner=root group=root mode=0644
when:
- not dist.stat.exists

- name: Install Riak for Debian
package: "name={{ riak_package }} state=present update_cache=yes"
tags: Debian
when: "'deb' not in riak_package"

- name: Install Riak for Debian
package: name={{ riak_package }} state=present update_cache=yes
apt: "deb={{ riak_package }}"
tags: Debian
when:
- "'deb' in riak_package"
- not dist.stat.exists

- name: Set the riak ulimit for Debian
copy: src=etc_default_riak_ulimit dest=/etc/default/riak owner=riak group=riak
Expand Down
7 changes: 2 additions & 5 deletions tasks/RedHat.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
---
- name: Include RHEL vars
include_vars: RedHat.yml
tags: RedHat

- name: "Install Java & libselinux-python"
package: "name={{ item }} state=present"
tags: RedHat
Expand All @@ -20,7 +16,8 @@
- name: Install package cloud repo if Riak is not already installed
command: '/tmp/packagecloud_rpm.sh'
tags: RedHat
when: not dist.stat.exists
when:
- not dist.stat.exists

- name: Install Riak for RedHat
package: "name={{ riak_package }} state=present"
Expand Down
1 change: 1 addition & 0 deletions tasks/buckets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
command: '{{ riak_admin }} bucket-type activate {{ item.name }}'
with_items: '{{ riak_bucket_types }}'
when: riak_bucket_types is defined and types.stdout.find(item.name + " (active)") < 0
ignore_errors: true
27 changes: 4 additions & 23 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,42 +30,23 @@
template: src=etc_sysctl.d_riak.conf.j2 dest=/etc/sysctl.d/riak.conf owner=root group=root mode=0644

- name: copy custom beams
synchronize: src={{ riak_custom_beams_dir }} dest={{ riak_patch_dir }}
synchronize: "src={{ riak_custom_beams_dir }} dest={{ riak_patch_dir }}"
when: riak_custom_beams_dir is defined

- name: Check if this is first pass
stat: path=/etc/riak/riak.conf.dist
register: dist

- name: Check if this is first pass
stat: path=/etc/riak/riak_shell.config.dist
register: distts
when: riak_package == "riak-ts"

- name: preserve distribution copy of riak.conf if not already done
command: "cp -i /etc/riak/riak.conf /etc/riak/riak.conf.dist"
tags: configfiles
when: not dist.stat.exists

- name: preserve distribution copy of riak_shell.config if not already done
command: "cp -i /etc/riak/riak_shell.config /etc/riak/riak_shell.config.dist"
tags: configfiles
when: riak_package == "riak-ts" and not distts.stat.exists

- name: install riak.conf with templated configuration
template: src={{ riak_conf_template }} dest=/etc/riak/riak.conf owner=root group=root mode=0444
template: "src={{ riak_conf_template }} dest=/etc/riak/riak.conf owner=root group=root mode=0444 backup=yes"
notify: restart riak

- name: install riak_shell.config with templated configuration
template: src={{ riak_shell_conf_template }} dest=/etc/riak/riak_shell.config owner=root group=root mode=0444
template: "src={{ riak_shell_conf_template }} dest=/etc/riak/riak_shell.config owner=root group=root mode=0444"
when: riak_package == "riak-ts" and riak_shell_nodes is defined
notify: restart riak

- name: Make certain Riak is started and set to start on boot
service: name=riak enabled=yes state=started

- name: Wait for Riak to start up before continuing
wait_for: delay=5 timeout=30 host={{ riak_pb_bind_ip }} port={{ riak_pb_port }} state=started
wait_for: "delay=5 timeout=30 host={{ riak_pb_bind_ip }} port={{ riak_pb_port }} state=started"

- name: Bucket operations
include: buckets.yml
Expand Down
Loading

0 comments on commit 35a88cf

Please sign in to comment.