Update Virtual Resource for riak cluster

This commit is contained in:
Łukasz Oleś 2015-09-29 15:04:38 +02:00
parent ebb3048a80
commit b5212fc266

View File

@ -1,139 +1,51 @@
id: riak_node id: riak_cluster
resources: resources:
- id: riak_service0 - id: riak_service1
from: resources/riak_node from: examples/riak/riak_service.yaml
location: {{nodes[0]}}
values: values:
riak_self_name: 'riak0' node: {{nodes[0]}}
riak_hostname: 'riak_server0.solar' index: 1
riak_name: 'riak0@riak_server0.solar' join_to: ''
ip: '{{nodes[0]}}::ip'
{% for i in range(1, idx|int) %} - id: riak_service2
- id: riak_service{{i}} from: examples/riak/riak_service.yaml
from: resources/riak_node
location: {{nodes[i]}}
values: values:
riak_self_name: 'riak{{i}}' node: {{nodes[1]}}
riak_hostname: 'riak_server{{i}}.solar' index: 2
riak_name: 'riak{{i}}@riak_server{{i}}.solar' join_to: riak_service1
join_to: 'riak_service0::riak_name'
ip: '{{nodes[i]}}::ip'
{% endfor %}
{% for i in range(idx|int) %} - id: riak_service3
- id: hosts_file{{i}} from: examples/riak/riak_service.yaml
from: resources/hosts_file
location: {{nodes[i]}}
values: values:
hosts:name: node: {{nodes[2]}}
{% for j in range(idx|int) %} index: 3
- riak_service{{j}}::riak_hostname::NO_EVENTS join_to: riak_service1
{% endfor %}
hosts:ip:
{% for j in range(idx|int) %}
- riak_service{{j}}::ip::NO_EVENTS
{% endfor %}
{% endfor %}
- id: haproxy_riak_config_http - id: haproxy_riak_config
from: resources/haproxy_service_config from: examples/riak/haproxy_riak_config.yaml
values: values:
listen_port: 8098 http_listen_port: 8098
protocol: 'http' pb_listen_port: 8087
name: 'riak_haproxy_http' riaks: ['riak_service1', 'riak_service2', 'riak_service3']
backends:server:
{% for j in range(idx|int) %}
- riak_service{{j}}::riak_hostname
{% endfor %}
backends:port:
{% for j in range(idx|int) %}
- riak_service{{j}}::riak_port_http
{% endfor %}
- id: haproxy_riak_config_pb - id: haproxy1
from: resources/haproxy_service_config from: templates/haproxy.yaml
values: values:
listen_port: 8087 node: {{nodes[0]}}
protocol: 'tcp' service_configs: ['haproxy_riak_config_pb', 'haproxy_riak_config_http']
name: 'riak_haproxy_pb' index: 1
backends:server:
{% for j in range(idx|int) %}
- riak_service{{j}}::riak_hostname
{% endfor %}
backends:port:
{% for j in range(idx|int) %}
- riak_service{{j}}::riak_port_pb
{% endfor %}
{% for i in range(idx|int) %} - id: haproxy2
- id: haproxy_config{{i}} from: templates/haproxy.yaml
from: resources/haproxy_config
location: {{nodes[i]}}
values: values:
config:protocol: node: {{nodes[1]}}
- haproxy_riak_config_http::protocol service_configs: ['haproxy_riak_config_pb', 'haproxy_riak_config_http']
- haproxy_riak_config_pb::protocol index: 2
config:listen_port:
- haproxy_riak_config_http::listen_port
- haproxy_riak_config_pb::listen_port
config:name:
- haproxy_riak_config_http::name
- haproxy_riak_config_pb::name
config:backends:
- haproxy_riak_config_http::backends
- haproxy_riak_config_pb::backends
ip: '{{nodes[i]}}::ip'
{% endfor %}
{% for i in range(idx|int) %} - id: haproxy3
- id: haproxy_service{{i}} from: templates/haproxy.yaml
location: {{nodes[i]}}
from: resources/haproxy_service
values: values:
ip: '{{nodes[i]}}::ip' node: {{nodes[2]}}
{% endfor %} service_configs: ['haproxy_riak_config_pb', 'haproxy_riak_config_http']
index: 3
events:
{% for i in range(idx|int) %}
- type: depends_on
parent_action: 'hosts_file{{i}}.run'
state: 'success'
depend_action: 'riak_service{{i}}.run'
{% endfor %}
{% for i in range(1, idx|int) %}
- type: react_on
parent_action: 'riak_service{{i}}.run'
state: 'success'
depend_action: 'riak_service{{i}}.join'
- type: react_on
parent_action: 'riak_service{{i}}.leave'
state: 'success'
depend_action: 'riak_service{{i}}.join'
- type: react_on
parent_action: 'riak_service{{i}}.join'
state: 'success'
depend_action: 'riak_service0.commit'
{% endfor %}
{% for i in range(1, idx|int) %}
- type: depends_on
parent_action: 'haproxy_service{{i}}.run'
state: 'success'
depend_action: 'haproxy_config{{i}}.run'
- type: react_on
parent_action: 'haproxy_config{{i}}.run'
state: 'success'
depend_action: 'haproxy_service{{i}}.apply_config'
- type: react_on
parent_action: 'haproxy_config{{i}}.update'
state: 'success'
depend_action: 'haproxy_service{{i}}.apply_config'
{% endfor %}