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

pull/1/head
Mauro Mugnaini 2 years ago
parent 95cd7d1c2e
commit 31710af6d5
  1. 1
      ansible/roles/conductor/defaults/main.yaml
  2. 11
      ansible/roles/conductor/tasks/main.yaml
  3. 15
      ansible/roles/conductor/templates/conductor-swarm-config.properties.j2
  4. 2
      ansible/roles/dynomite/tasks/main.yaml
  5. 2
      ansible/roles/dynomite/templates/dynomite-service.yaml.j2
  6. 27
      ansible/site.yaml

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

@ -4,7 +4,12 @@
src: templates/conductor-swarm.yaml.j2
dest: "{{ target_path }}/conductor-swarm.yaml"
- name: Copy conductor config
copy:
src: "{{ conductor_config }}"
- name: Prepare seeds variable reading generated file lines
debug: msg="{{item}}"
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 }}"

@ -13,7 +13,19 @@ db=dynomite
# Dynomite Cluster details.
# 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
workflow.dynomite.cluster.name=dyno1
@ -55,4 +67,3 @@ workflow.elasticsearch.index.name=conductor
# Load sample kitchen sink workflow
loadSample=false

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

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

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

Loading…
Cancel
Save