Skip to content

Instantly share code, notes, and snippets.

@UtahDave
Created July 18, 2013 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save UtahDave/9623f597dbd38f4c55ae to your computer and use it in GitHub Desktop.
Save UtahDave/9623f597dbd38f4c55ae to your computer and use it in GitHub Desktop.
An example of using the riak module. The riak state didn't exist yet, hence using module.run to execute a module function. The key point here is the use of the publish.publish to query the ip address of the 'riak00' server.
riak-repo:
pkgrepo.managed:
- name: deb http://apt.basho.com precise main
- disabled: False
- key_url: http://apt.basho.com/gpg/basho.apt.key
- require_in:
- pkg: riak
riak:
pkg.installed
/etc/riak/app.config:
file:
- managed
- source: salt://riak/app.config
- template: jinja
- require:
- pkg: riak
/etc/riak/vm.args:
file:
- managed
- source: salt://riak/vm.args
- template: jinja
- require:
- pkg: riak
riak.start:
module:
- run
- require:
- file: /etc/riak/app.config
- file: /etc/riak/vm.args
riak.cluster_join:
module:
- run
- riak_user: riak
- riak_host: {{ salt['publish.publish']('riak00', 'network.ip_addrs')['riak00']['ret'].pop() }}
- require:
- module: riak.start
# Add this to your master config
peer:
'riak*':
- network.ip_addrs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment