Conductor swarm config properties is now generared from template using `seeds.list` generated by dynomite role

pull/1/head
Mauro Mugnaini 4 years ago
parent 95cd7d1c2e
commit 31710af6d5

@ -1,3 +1,4 @@
--- ---
conductor_replicas: 2 conductor_replicas: 2
conductor_config: conductor-swarm-config.properties conductor_config: conductor-swarm-config.properties
conductor_config_template: "{{ conductor_config }}.j2"

@ -4,7 +4,12 @@
src: templates/conductor-swarm.yaml.j2 src: templates/conductor-swarm.yaml.j2
dest: "{{ target_path }}/conductor-swarm.yaml" dest: "{{ target_path }}/conductor-swarm.yaml"
- name: Copy conductor config - name: Prepare seeds variable reading generated file lines
copy: debug: msg="{{item}}"
src: "{{ conductor_config }}" loop: "{{ lookup('file', '{{ target_path}}/seeds.list').splitlines() }}"
register: seeds
- name: Generate conductor config from seeds
template:
src: "templates/{{ conductor_config_template }}"
dest: "{{ target_path }}/{{ conductor_config }}" dest: "{{ target_path }}/{{ conductor_config }}"

@ -13,7 +13,19 @@ db=dynomite
# Dynomite Cluster details. # Dynomite Cluster details.
# format is host:port:rack separated by semicolon # format is host:port:rack separated by semicolon
workflow.dynomite.cluster.hosts=dynomite1:8102:us-east-1b;dynomite2:8102:us-east-1b;dynomite3:8102:us-east-2b;dynomite4:8102:us-east-2b workflow.dynomite.cluster.hosts={% set ns = namespace() %}
{% set ns.datacenter = "us-east-" %}
{% set ns.current_rack = "" %}
{% set ns.current_suffix = 0 %}
{% for seed in seeds.results %}
{% set ns.seed_tokens = seed.msg.split(':') %}
{% if ns.seed_tokens[2] != ns.current_rack %}
{% set ns.current_rack = ns.seed_tokens[2] %}
{% set ns.current_suffix = ns.current_suffix + 1 %}
{% endif %}
{{ ns.seed_tokens[0] }}:8102:{{ ns.seed_tokens[3] }}-{{ ns.current_suffix }}{%- if not loop.last %};{%- endif %}
{%- endfor %}
# Dynomite cluster name # Dynomite cluster name
workflow.dynomite.cluster.name=dyno1 workflow.dynomite.cluster.name=dyno1
@ -55,4 +67,3 @@ workflow.elasticsearch.index.name=conductor
# Load sample kitchen sink workflow # Load sample kitchen sink workflow
loadSample=false loadSample=false

@ -4,7 +4,7 @@
src: templates/seeds.list.j2 src: templates/seeds.list.j2
dest: "{{ target_path }}/seeds.list" dest: "{{ target_path }}/seeds.list"
- name: Prepare seeds - name: Prepare seeds variable reading generated file lines
debug: msg="{{item}}" debug: msg="{{item}}"
loop: "{{ lookup('file', '{{ target_path}}/seeds.list').splitlines() }}" loop: "{{ lookup('file', '{{ target_path}}/seeds.list').splitlines() }}"
register: seeds register: seeds

@ -11,7 +11,7 @@
deploy: deploy:
mode: replicated mode: replicated
replicas: 1 replicas: 1
endpoint_mode: dnsrr #endpoint_mode: dnsrr
placement: placement:
constraints: [node.role == worker] constraints: [node.role == worker]
restart_policy: restart_policy:

@ -1,17 +1,17 @@
--- ---
#- hosts: localhost - hosts: localhost
# roles: roles:
# - common - common
# - dynomite - dynomite
# - elasticsearch - elasticsearch
# tasks: tasks:
# - name: Start dynomite and es - name: Start dynomite and es
# docker_stack: docker_stack:
# name: conductor name: conductor
# state: present state: present
# compose: compose:
# - "{{ target_path }}/dynomite-swarm.yaml" - "{{ target_path }}/dynomite-swarm.yaml"
# - "{{ target_path }}/elasticsearch-swarm.yaml" - "{{ target_path }}/elasticsearch-swarm.yaml"
- hosts: localhost - hosts: localhost
@ -25,4 +25,3 @@
state: present state: present
compose: compose:
- "{{ target_path }}/conductor-swarm.yaml" - "{{ target_path }}/conductor-swarm.yaml"

Loading…
Cancel
Save