From 919dccb12ff9400816a68132860588587b4c6a6b Mon Sep 17 00:00:00 2001 From: Mauro Mugnaini Date: Tue, 27 Oct 2020 10:54:01 +0100 Subject: [PATCH] added ansible bootstrap --- ansible/roles/common/defaults/main.yaml | 10 +++++++++ ansible/roles/dynomite/tasks/main.yaml | 3 +++ .../dynomite/templates/dynomite-seed-entry.j2 | 1 + .../templates/dynomite-service.yaml.j2 | 22 +++++++++++++++++++ .../dynomite/templates/dynomite-swarm.yaml.j2 | 11 ++++++++++ 5 files changed, 47 insertions(+) create mode 100644 ansible/roles/common/defaults/main.yaml create mode 100644 ansible/roles/dynomite/tasks/main.yaml create mode 100644 ansible/roles/dynomite/templates/dynomite-seed-entry.j2 create mode 100644 ansible/roles/dynomite/templates/dynomite-service.yaml.j2 create mode 100644 ansible/roles/dynomite/templates/dynomite-swarm.yaml.j2 diff --git a/ansible/roles/common/defaults/main.yaml b/ansible/roles/common/defaults/main.yaml new file mode 100644 index 0000000..76c1a9a --- /dev/null +++ b/ansible/roles/common/defaults/main.yaml @@ -0,0 +1,10 @@ +--- +conductor_network: conductor-network + +dynomite_shards: 2 +dynomite_replicas: 3 + +elasticsearch_replicas: 1 + +conductor_replicas: 2 + diff --git a/ansible/roles/dynomite/tasks/main.yaml b/ansible/roles/dynomite/tasks/main.yaml new file mode 100644 index 0000000..fbffaf2 --- /dev/null +++ b/ansible/roles/dynomite/tasks/main.yaml @@ -0,0 +1,3 @@ +--- +- name: Hello world dynomite + command: echo "Hello world" diff --git a/ansible/roles/dynomite/templates/dynomite-seed-entry.j2 b/ansible/roles/dynomite/templates/dynomite-seed-entry.j2 new file mode 100644 index 0000000..e295b79 --- /dev/null +++ b/ansible/roles/dynomite/templates/dynomite-seed-entry.j2 @@ -0,0 +1 @@ +{{ service }}:8101:{{ rack }}:{{ datacenter }}:{{ token }} diff --git a/ansible/roles/dynomite/templates/dynomite-service.yaml.j2 b/ansible/roles/dynomite/templates/dynomite-service.yaml.j2 new file mode 100644 index 0000000..38cfb00 --- /dev/null +++ b/ansible/roles/dynomite/templates/dynomite-service.yaml.j2 @@ -0,0 +1,22 @@ + 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 diff --git a/ansible/roles/dynomite/templates/dynomite-swarm.yaml.j2 b/ansible/roles/dynomite/templates/dynomite-swarm.yaml.j2 new file mode 100644 index 0000000..a65519f --- /dev/null +++ b/ansible/roles/dynomite/templates/dynomite-swarm.yaml.j2 @@ -0,0 +1,11 @@ +version: '3.6' + +services: + {{ dynomyte_services }} + +networks: + {{ conductor_network }}: + +configs: + seeds.list: + file: {{ seeds_list_path }}