Skip to content

Class[riak]: Parameters and Configuration

haf edited this page Sep 2, 2012 · 7 revisions

The Riak Class

The module is centered around the riak class. The all-defaults configuration looks like this:

class { 'riak': }

Modifying Parameters

You can modify the configuration by passing a hash to either cfg (feeds into App.config) or to vmargs_cfg, which feeds vm.args. Here's an example of adding a https binding with a custom certfile and keyfile.

class { 'riak':
  cfg => {
    riak_core => {
      https => {
        "__string_${$::ipaddress}" => 8443
      },
      ssl => {
        certfile => "${etc_dir}/cert.pem",
        keyfile  => "${etc_dir}/key.pem"
      }
    }
  }
}

The configuration options are equal to any that Riak accepts. Have a look at Basho's wiki for a complete listing, or at the rebar-file in their repo.

The prefix __string_ is one of many. They work like this:

Puppet Array

Create an Erlang tuple:

['__tuple_', 46, $::ipaddress, 'whatever']

Create an Erlang list:

['__list_', 46, $::ipaddress, 'whatever']

Puppet String

Create an Erlang atom:

'__atom_certfile'

Create an Erlang binary string:

'__binary_mystringcomeshere'

Puppet Hash

All keys in a puppet hash are translated by default to Erlang atoms, because that's what the config uses most of the time. In the case that you need a key to be translated to a string, e.g. like in this code:

class { riak:
  cfg => {
  # ...
  riak_core => {
    http => {
      "__string_${$::ipaddress}" => 8098
    }
  # ...
  }
}

you simply prefix the key with __string_.

All hashes will be sorted on keys, in each layer, to make sure that the files change as little as possible from puppet run to puppet run.

Swoosh through the links to become skilled at ninja arts in distributed systems provisioning.

Clone this wiki locally