added ansible roles for swarming dynomite

pull/1/head
dcore94 2 years ago
parent 198a14fc59
commit cb033e7163
  1. 5
      ansible/playbook.yml
  2. 4
      ansible/roles/common/defaults/main.yaml
  3. 4
      ansible/roles/common/tasks/main.yaml
  4. 15
      ansible/roles/dynomite/tasks/main.yaml
  5. 1
      ansible/roles/dynomite/templates/dynomite-seed-entry.j2
  6. 47
      ansible/roles/dynomite/templates/dynomite-service.yaml.j2
  7. 4
      ansible/roles/dynomite/templates/dynomite-swarm.yaml.j2
  8. 6
      ansible/roles/dynomite/templates/seeds.list.j2

@ -0,0 +1,5 @@
---
- hosts: localhost
roles:
- common
- dynomite

@ -1,7 +1,9 @@
---
target_path: /tmp/conductor_setup_test
conductor_network: conductor-network
dynomite_shards: 2
dynomite_shards: 3
dynomite_replicas: 3
elasticsearch_replicas: 1

@ -0,0 +1,4 @@
- name: Create target directory
file:
path: "{{ target_path }}"
state: directory

@ -1,3 +1,18 @@
---
- name: Hello world dynomite
command: echo "Hello world"
- name: Generate seedlist
template:
src: templates/seeds.list.j2
dest: "{{ target_path }}/seeds.list"
- name: Prepare seeds
debug: msg="{{item}}"
loop: "{{ lookup('file', '{{ target_path}}/seeds.list').splitlines() }}"
register: seeds
- name: Generate dynomite-swarm
template:
src: templates/dynomite-swarm.yaml.j2
dest: "{{ target_path }}/dynomite-swarm.yaml"

@ -1 +0,0 @@
{{ service }}:8101:{{ rack }}:{{ datacenter }}:{{ token }}

@ -1,22 +1,25 @@
dynomite1:
environment:
- DYNO_NODE={{ node_seed }}
image: nubisware/autodynomite:latest
networks:
{{ conductor-network }}:
logging:
driver: "journald"
deploy:
mode: replicated
replicas: 1
endpoint_mode: dnsrr
placement:
constraints: [node.role == worker]
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
configs:
- source: seeds.list
target: /dynomite/seeds.list
{% for seed in seeds.results %}
{{ seed.msg.split(':')[0] }}:
environment:
- DYNO_NODE={{ seed.msg }}
image: nubisware/autodynomite:latest
networks:
{{ conductor_network }}:
logging:
driver: "journald"
deploy:
mode: replicated
replicas: 1
endpoint_mode: dnsrr
placement:
constraints: [node.role == worker]
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
configs:
- source: seeds.list
target: /dynomite/seeds.list
{%endfor%}

@ -1,11 +1,11 @@
version: '3.6'
services:
{{ dynomyte_services }}
{% include 'dynomite-service.yaml.j2' %}
networks:
{{ conductor_network }}:
configs:
seeds.list:
file: {{ seeds_list_path }}
file: seeds.list

@ -0,0 +1,6 @@
{% for replica in range(1,dynomite_replicas+1) %}
{% set replicaloop = loop %}
{% for shard in range(1,dynomite_shards+1) %}
dynomite{{ (replicaloop.index - 1) * dynomite_shards + shard}}:8101:rack{{ replicaloop.index }}:datacenter1:{{ (shard - 1) * (4294967295 // dynomite_shards) }}
{% endfor %}
{% endfor %}
Loading…
Cancel
Save