Riak example ported to new transports

This commit is contained in:
Jedrzej Nowak 2015-09-24 17:00:22 +02:00
parent b2500ce898
commit e18224fa84
2 changed files with 47 additions and 21 deletions

3
examples/riak/riaks.py Normal file → Executable file
View File

@ -32,7 +32,8 @@ db = get_db()
def setup_riak():
db.clear()
nodes = vr.create('nodes', 'templates/riak_nodes.yaml', {})
resources = vr.create('nodes', 'templates/riak_nodes.yaml', {'count': 3})
nodes = [x for x in resources if x.name.startswith('node')]
node1, node2, node3 = nodes
riak_services = []

View File

@ -1,23 +1,48 @@
id: simple_riak_cluster
id: simple_riak_with_transports
resources:
- id: node1
{% for i in range(count|int) %}
{% set j = i +1 %}
- id: ssh_transport{{j}}
from: resources/transport_ssh
values:
ssh_user: 'vagrant'
ssh_key: '/vagrant/.vagrant/machines/solar-dev{{j}}/virtualbox/private_key'
- id: transports{{j}}
from: resources/transports
values:
transports:key: ssh_transport{{j}}::ssh_key
transports:user: ssh_transport{{j}}::ssh_user
transports:port: ssh_transport{{j}}::ssh_port
transports:name: ssh_transport{{j}}::name
- id: node{{j}}
from: resources/ro_node
values:
ip: '10.0.0.3'
name: 'node1'
ssh_key: '/vagrant/.vagrant/machines/solar-dev1/virtualbox/private_key'
ssh_user: 'vagrant'
- id: node2
from: resources/ro_node
values:
ip: '10.0.0.4'
name: 'node2'
ssh_key: '/vagrant/.vagrant/machines/solar-dev2/virtualbox/private_key'
ssh_user: 'vagrant'
- id: node3
from: resources/ro_node
values:
ip: '10.0.0.5'
name: 'node3'
ssh_key: '/vagrant/.vagrant/machines/solar-dev3/virtualbox/private_key'
ssh_user: 'vagrant'
name: node{{j}}
ip: '10.0.0.{{i + 3}}'
transports_id: transports{{j}}::transports_id
{% endfor %}
# id: simple_riak_cluster
# resources:
# - id: node1
# from: resources/ro_node
# values:
# ip: '10.0.0.3'
# name: 'node1'
# ssh_key: '/vagrant/.vagrant/machines/solar-dev1/virtualbox/private_key'
# ssh_user: 'vagrant'
# - id: node2
# from: resources/ro_node
# values:
# ip: '10.0.0.4'
# name: 'node2'
# ssh_key: '/vagrant/.vagrant/machines/solar-dev2/virtualbox/private_key'
# ssh_user: 'vagrant'
# - id: node3
# from: resources/ro_node
# values:
# ip: '10.0.0.5'
# name: 'node3'
# ssh_key: '/vagrant/.vagrant/machines/solar-dev3/virtualbox/private_key'
# ssh_user: 'vagrant'